webdriver.support.wait

Module Contents

Classes

WebDriverWait(self,driver,timeout,poll_frequency=POLL_FREQUENCY,ignored_exceptions=None)
class WebDriverWait(driver, timeout, poll_frequency=POLL_FREQUENCY, ignored_exceptions=None)
__init__(driver, timeout, poll_frequency=POLL_FREQUENCY, ignored_exceptions=None)

Constructor, takes a WebDriver instance and timeout in seconds.

Args:
  • driver - Instance of WebDriver (Ie, Firefox, Chrome or Remote)
  • timeout - Number of seconds before timing out
  • poll_frequency - sleep interval between calls By default, it is 0.5 second.
  • ignored_exceptions - iterable structure of exception classes ignored during calls. By default, it contains NoSuchElementException only.
Example:

from selenium.webdriver.support.ui import WebDriverWait n element = WebDriverWait(driver, 10).until(lambda x: x.find_element_by_id(“someId”)) n is_disappeared = WebDriverWait(driver, 30, 1, (ElementNotVisibleException)).n

until_not(lambda x: x.find_element_by_id(“someId”).is_displayed())
__repr__()
until(method, message="")

Calls the method provided with the driver as an argument until the return value is not False.

until_not(method, message="")

Calls the method provided with the driver as an argument until the return value is False.