Explicit and implicit wait


I am new to selenium (but experienced java developer).

I am using something like below:

where pWait is:
WebDriverWait wait = new WebDriverWait(driver, 15);

however when I run the test case I get below error:
Unable to locate element: {“method”:”xpath”,”selector”:”//a[contains(.,’Search&Baskets’)]”}
Command duration or timeout: 4 milliseconds

I thought it should have wait atleast 15 seconds before throwing this exception. From the log above it looks like it threw exception only in 4ms.
and i could see on console that as soon as it hit that line, it threw exception.

I have implicit waiting set as 0 and using explicit wait.

Am i missing anything here.

Also, in explicit and implicit wait, is it upto that much time OR exact that much time,
example if I set implicit wait as 10 sec, then does it mean wait for exact 10 sec OR wait upto 10 sec (if element found then proceed, even if element founf on 6th second)

is above same for explicit wait as well?

Please help

Default Asked on December 6, 2017 in Selenium WebDriver.
Add Comment
  • 0 Answer(s)
  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.