Select stockLocation = new Select(
new WebDriverWait(driver, 100)
.until(ExpectedConditions.visibilityOfElementLocated(
By.xpath("//select[@class='form-control ng-pristine ng-valid ng-not-empty ng-touched']")
)
)
);
stockLocation.selectByVisibleText("03 - Damage (viewable)");
错误:
Exception in thread "main" org.openqa.selenium.TimeoutException: Expected condition failed: waiting for visibility of element located by By.xpath: //select[@class='form-control ng-pristine ng-valid ng-not-empty ng-touched'] org.openqa.selenium.support.ui.WebDriverWait.timeoutException(WebDriverWait.java:95) at org.openqa.selenium.support.ui.FluentWait.until(FluentWait.java:272) at com.ups.vcat.VcatAutoUpdateFreightException.main(VcatAutoUpdateFreightException.java:44) Caused by: org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element