d模式查找元素timeout支持0秒

This commit is contained in:
g1879 2021-01-01 01:20:18 +08:00
parent adb1952d9f
commit 6421b43aa9
3 changed files with 3 additions and 3 deletions

View File

@ -585,7 +585,7 @@ def execute_driver_find(page_or_ele,
driver = page_or_ele.driver
try:
if timeout and timeout != page.timeout:
if timeout is not None and timeout != page.timeout:
wait = WebDriverWait(driver, timeout=timeout)
else:
page.wait._driver = driver

View File

@ -199,7 +199,7 @@ class DriverPage(object):
else:
raise ValueError('Argument loc_or_str can only be tuple, str, DriverElement, DriverElement.')
timeout = timeout or self.timeout
timeout = timeout if timeout is not None else self.timeout
return execute_driver_find(self, loc_or_ele, mode, timeout)
def eles(self,

View File

@ -379,7 +379,7 @@ class MixPage(Null, SessionPage, DriverPage):
if self._mode == 's':
return super().ele(loc_or_ele, mode=mode)
elif self._mode == 'd':
timeout = timeout or self.timeout
timeout = timeout if timeout is not None else self.timeout
return super(SessionPage, self).ele(loc_or_ele, mode=mode, timeout=timeout)
def eles(self,