SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.64k stars 8.18k forks source link

Exception in thread "main" java.lang.NoSuchMethodError: 'void org.openqa.selenium.support.ui.WebDriverWait.<init>(org.openqa.selenium.WebDriver, java.time.Duration)' at ExplicitWait.main(ExplicitWait.java:22)[🐛 Bug]: #13530

Closed RaoInam07 closed 9 months ago

RaoInam07 commented 9 months ago

What happened?

I am wokring explicit wait and getting this exception how should i resolved this

2024-01-31_12-22-53

How can we reproduce the issue?

import java.time.Duration;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;

import io.github.bonigarcia.wdm.WebDriverManager;

public class ExplicitWait {

    public static void main(String[] args) {
        WebDriverManager.chromedriver().setup();
        ChromeDriver driver = new ChromeDriver();

        driver.get("https://www.ebay.com/");
        driver.manage().window().maximize();
        WebElement element = driver.findElement(By.xpath("//*[@id=\"vl-flyout-nav\"]/ul/li[6]/a"));
        Actions action = new Actions(driver);
        action.moveToElement(element).perform();
        WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10));

        WebElement ebay =   wait.until(ExpectedConditions.visibilityOfElementLocated
        (By.xpath("//*[@id=\"vl-flyout-nav\"]/ul/li[6]/div[2]/div[1]/nav[2]/ul/li[1]/a")));
    ebay.click();

    }

}

Relevant log output

Exception in thread "main" java.lang.NoSuchMethodError: 'void org.openqa.selenium.support.ui.WebDriverWait.<init>(org.openqa.selenium.WebDriver, java.time.Duration)'
    at ExplicitWait.main(ExplicitWait.java:22)

Operating System

Windows 11

Selenium version

4.16.1

What are the browser(s) and version(s) where you see this issue?

Version 121.0.6167.86

What are the browser driver(s) and version(s) where you see this issue?

ChromeDriver

Are you using Selenium Grid?

No response

github-actions[bot] commented 9 months ago

@RaoInam07, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

titusfortner commented 9 months ago

I'm pretty sure you have a dependency conflict in your jars. See this — https://www.javaadvent.com/2020/12/how-to-debug-dependency-conflicts-in-maven-and-gradle.html

I'll add some links below for if you have follow-up questions.

github-actions[bot] commented 9 months ago

💬 Please ask questions at:

RaoInam07 commented 9 months ago

Still not work

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.