0

Many of the dropdowns on the webpage I'm working has the selections populated dynamically. When working with Selenium sometimes I need a wait moving from one element to the other.

I tried using driver.manage().timeouts().implicitlyWait(2,TimeUnit.SECONDS) but it doesn't seem to be working as I'd expect and often the elements still aren't found. I thought I'd try using Thread.sleep(1500) and it works every time. Does anyone have any idea why this is? I would think the wait would be the better of the two?

WeVie
  • 568
  • 2
  • 9
  • 25
  • post your code trials and exceptions thrown. Basically implicit will only wait until an element is found, but that is not necessarily all you need to wait for. – pcalkins Jan 27 '20 at 20:45
  • It was my understanding it would simply wait the number is TimeUnits I specify, in this case 2 seconds. Is that not correct? – WeVie Jan 27 '20 at 21:27
  • it'll wait until the element is found, which could be sooner. It will only work on findElement or findElements I believe... it polls the DOM every 1/2 second. – pcalkins Jan 27 '20 at 22:13
  • Never use Thread. Use Pyppeteer if you must have concurrency. – pguardiario Jan 28 '20 at 09:17

0 Answers0