def _wait_for(self, wait_function, **kwargs):
'''
Wrapper to handle the boilerplate involved with a custom wait.
Parameters
----------
wait_function: func
This can be a builtin selenium wait_for class,
a special wait_for class that implements the __call__ method,
or a lambda function
timeout: int
The number of seconds to wait for the given condition
before throwing an error.
Overrides WebRunner.timeout
'''
try:
wait = WebDriverWait(self.browser, kwargs.get('timeout') or self.timeout)
wait.until(wait_function)
except TimeoutException:
if self.driver == 'Gecko':
print("Geckodriver can't use the text_to_be_present_in_element_value wait for some reason.")
else:
raise
评论列表
文章目录