0

In my framework we are using singleton driver and we are mainly using explicit wait. As documentation suggests we shouldn't use both together but at some points because of synchronization issues I need to use implicit wait.

In that case I found a workaround, I add implicit wait to my driver, then at the end of this test I just create brand new driver.

But I would like to know if there is any other way to do that ?

Taha A
  • 1
  • (1) What sync issues you get? Can't they be resolved with `webdriverwait` - with `presence_of_element`, `visibility_of_element_located`? and/or `element_to_be_clickable`, etc.? (2) What is the purpose of the driver instance when you are using `implict-wait` on it and then closing it and re-instantiating a new driver again? Are the 2nd driver's actions completely different and unrelated to the 1st instance? – Anand Gautam Mar 09 '22 at 04:48
  • There are some scenarios where I need to use wait for multiple elements, so instead of using explicit wait for each one by one I want to use implicit wait once for all. As the driver is singleton I only have one driver instance, and as I only want to implement implicit wait in that scenario I close my driver after I'm done and create brand new so implicit wait is gone, it's just a work around. – Taha A Mar 10 '22 at 13:00

1 Answers1

0

As per the documentation:

Warning: Do not mix implicit and explicit waits. Doing so can cause unpredictable wait times. For example, setting an implicit wait of 10 seconds and an explicit wait of 15 seconds could cause a timeout to occur after 20 seconds.

undetected Selenium
  • 183,867
  • 41
  • 278
  • 352