AttributeError: module 'selenium.webdriver.support' has no attribute 'wait'

Viewed 710

When I try to wait for an element to pop up in selenium it says that it doesn't exist. Even though it says it in the documentation of selenium..

My code : webdriver.support.wait.WebDriverWait(driver, 120).until(lambda x: x.find_element_by_css_selector('.antigate_solver.solved'))

1 Answers

Its somewhat incorrectly used I guess -

import should look like this -

from selenium.webdriver.support.ui import WebDriverWait

and your code should look like this -

WebDriverWait(driver, 120).until(lambda x: x.find_element_by_css_selector('.antigate_solver.solved'))

or

wait = WebDriverWait(driver, 120)
wait.until(lambda x: x.find_element_by_css_selector('.antigate_solver.solved'))
Related