当我测试phptravel网站并尝试使用以下代码单击myaccount链接时。Selenium在执行期间返回ElementNotVisibleException。我错过了什么?
源代码
public void login(WebDriver driver) {
driver.navigate().to("https://www.phptravels.net/");
WebDriverWait wait = new WebDriverWait(driver, 10);
wait.until(ExpectedConditions.elementToBeClickable(By.xpath("/html/body/nav/div/div[1]/a")));
// Error on here
myAccount.click();
WebDriverWait myAccountWait = new WebDriverWait(driver, 10);
myAccountWait.until(ExpectedConditions.presenceOfElementLocated(By.xpath("//*[@id=\"li_myaccount\"]/ul")));
loginLink.click();
WebDriverWait loginWait = new WebDriverWait(driver, 10);
//loginWait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//*[@id=\\\"loginfrm\\\"]/div[1]/div[5]/div/div[1]/input")));
username.sendKeys("user@phptravels.com");
password.sendKeys("demouser");
loginBtn.click();
}
largeQ
相关分类