1

Is there a difference between:

self.driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

OR

self.driver.implicitly_wait(10) # seconds

Why does this 15 value explicit wait not over-ride the 10 seconds? Or is it the case once implicit is specified, it ignores the explicit?

btn = WebDriverWait(driver, 15).until(
         lambda wd: wd.find_element_by_css_selector('someCSS')  )

Any advice?

2
  • One is Java and the other is Python. Commented Jan 20, 2022 at 6:01
  • Also implicit wait is a set once wait for page to load. Commented Jan 20, 2022 at 6:02

1 Answer 1

2

From: https://selenium-python.readthedocs.io/waits.html#implicit-waits

An implicit wait tells WebDriver to poll the DOM for a certain amount of time when trying to find any element (or elements) not immediately available.

This syntax should be used for python:

self.driver.implicitly_wait(10) # seconds

Implicitly wait behavior is a very low level so it will affect other operations, like explicit waits.

This will work 100 seconds if no such element:

self.driver.implicitly_wait(100) # seconds
btn = WebDriverWait(driver, 10).until(
         lambda wd: wd.find_element_by_css_selector('someCSS')  )

This will work 20 seconds if no such element (need to recheck):

self.driver.implicitly_wait(10) # seconds
btn = WebDriverWait(driver, 11).until(
         lambda wd: wd.find_element_by_css_selector('someCSS')  )

This will work 15 seconds if no such element:

self.driver.implicitly_wait(5) # seconds
btn = WebDriverWait(driver, 15).until(
         lambda wd: wd.find_element_by_css_selector('someCSS')  )
Sign up to request clarification or add additional context in comments.

1 Comment

oh, ok thanks! I didn't realise that if implicit is greater, it takes implicit, and if it is equal it adds the implicit + explicit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.