0
votes

I am using implicit wait in my Script

driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);

as I have searched while googling, once driver not able to find the specified Locator,implicit wait waits for specified time period,here is 30 seconds.

but in case of my script,initially element is hidden after 2 or 3 seconds it gets appear, so when ever the element gets appear,driver able to locate it.Not waiting for 30 seconds.

Any body have any idea why it is working like fluent wait.

1
why not using an explicit wait ? - aberna
I was checking the difference between fluent wait and implicit wait,a per documents on different sites fluent wait uses polling mechanism and implicit wait check for locator for first and then waits for specified period either element present or not it will wait. But in my script implicit wait is also using polloing. - NecessaryDevil

1 Answers

0
votes

Please refer to the docs for implicitlyWait-

When searching for a single element, the driver should poll the page until the element has been found, or this timeout expires before throwing a {@link NoSuchElementException}. When searching for multiple elements, the driver should poll the page until at least one element has been found or this timeout has expired.

So according to docs there is a polling mechanism which is performed until the timeout happens. The time that you provide in implicitlyWait(30, TimeUnit.SECONDS) i.e. 30 secs here means it will wait for a max of 30 secs accompanied by continuous polling. Once it gets the element it will return back to driver for further execution unless Timeout occurs thus throwing NoSuchElementException. Don't compare it with Thread.sleep where you can pause the execution thread.