Selenium chrome驱动程序[JAVA]正在等待ubuntu的元素可点击

Selenium chrome驱动程序[JAVA]正在等待ubuntu的元素可点击,java,testing,selenium-webdriver,selenium-chromedriver,Java,Testing,Selenium Webdriver,Selenium Chromedriver,在同一应用程序中为EclipseIDE工作的代码在ubuntu*中似乎失败了。 请指导,在我做错的地方,我尝试添加等待条件和线程睡眠,但似乎没有任何效果 WebElement nav= driver.findElement(By.xpath("//*[@id='navbarNav']/ul[1]/li[2]/a")); System.out.println("RESULTS" +driver.getCurrentUrl()); WebDriverW

在同一应用程序中为EclipseIDE工作的代码在ubuntu*中似乎失败了。 请指导,在我做错的地方,我尝试添加等待条件和线程睡眠,但似乎没有任何效果

  WebElement nav= driver.findElement(By.xpath("//*[@id='navbarNav']/ul[1]/li[2]/a"));

System.out.println("RESULTS" +driver.getCurrentUrl());

WebDriverWait w= new WebDriverWait(driver, 200);
Thread.sleep(400);

w.until(ExpectedConditions.elementToBeClickable(nav));

Thread.sleep(400);
       nav.click();
错误

 Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for element to be clickable: [[ChromeDriver: chrome on LINUX (726e7ea18ab0340298b4be9c717b370b)] -> xpath: //*[@id='navbarNav']/ul[1]/li[2]/a] (tried for 200 second(s) with 500 milliseconds interval)
  
HTML代码

<div class="collapse navbar-collapse style-scope app-shell" id="navbarNav">
                <ul class="app-nav navbar-nav mr-auto style-scope app-shell">
                    <li class="nav-item style-scope app-shell">
                        <a class="nav-link p-3 px-4 style-scope app-shell" href="/#/dashboard">Dashboard</a>
                    </li>
                    <li class="nav-item style-scope app-shell">
                        <a class="nav-link py-3 px-4 style-scope app-shell active" href="/#/trend-analysis/tag-search">TrendAnalysis</a>
                        <ul class="sub-nav d-flex flex-row flex-nowrap list-unstyled style-scope app-shell">
                            <li class="sub-nav-item style-scope app-shell">
                                <a class="sub-nav-link style-scope app-shell active" href="#/trend-analysis/tag-search">
                                    Trend Analysis
                                </a>
                            </li>
                            <li class="sub-nav-item style-scope app-shell">
                                <a class="sub-nav-link style-scope app-shell" href="#/trend-analysis/value-based-search">
                                    Value-Based Search
                                </a>
                            </li>
                  .....

    • .....