NoSuchMethodError: org.openqa.selenium.support.ui.WebDriverWait.until

Viewed 9551

i am trying to run the below selenium code :

        WebDriver driver;
        System.setProperty("webdriver.chrome.driver", "C:\\Driver\\chromedriver.exe");
        driver = new ChromeDriver();
        driver.get("http://www.behsad.com/nportal/Default.aspx?tabid=55");

        driver.findElement(By.id("dnn_dnnUser_enhancedRegisterLink")).click();

        WebDriverWait wait=new WebDriverWait(driver, 30);
        WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(
                                        By.id("dnn_dnnUser_enhancedRegisterLink")));
        element.click();

here is my pom.xml:

<dependency>
    <groupId>info.cukes</groupId>
    <artifactId>cucumber-picocontainer</artifactId>
    <version>1.2.5</version>
</dependency>

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.4.0</version>
</dependency>

and at the end there is the imports of the code:

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

the code gets stuck in the line:

WebElement element = wait.until(ExpectedConditions.visibilityOfElementLocated(
                                            By.id("dnn_dnnUser_enhancedRegisterLink")));

and it complains with:

java.lang.NoSuchMethodError: org.openqa.selenium.support.ui.WebDriverWait.until(Lcom/google/common/base/Function;)Ljava/lang/Object;
3 Answers

It worked with latest jars:

Appium 1.8.1
Java-client 5.0.4
Selenium-java 3.7.1
Related