Search code examples
seleniumwait

Wait.until not working in selenium in web project


So far I used 2.53 version of selenium and all my waits were done this way -

WebDriverWait wait = new WebDriverWait(driver, 20);
WebElement elem = wait.until(ExpectedConditions.visibilityOfElementLocated(By.id("userId"));

Now I updated the selenium version to be 3.0.1 and I am getting the error at the corresponding line.

I have seen some of the solutions in some stack overflow threads. Their answers would be like.. higher versions of selenium no longer supporting wait.until and advised to add some dependency in maven project.

But unfortunately I have not used maven project. Am using web project. Can anyone know how to resolve this error? Or is there is any way to make browser wait other than wait.until?


Solution

  • 1) Go to https://mvnrepository.com/

    2) Search for the artifact you want to add (e.g. selenium-support)

    3) Click on the appropriate artifact link and then select required version

    4) Search for 'Files' section on the page and click on 'jar' to download the jar file.

    5) Add the downloaded jar to the 'Build Path' of your project.

    NOTE: Also check for the compile dependencies mentioned on the page.