selenium 等待元素
/** * * @param driver * @param by * @param seconds 等待多少秒 * @return */ public WebElement waitPageOpen(WebDriver driver,By by,long seconds){ WebDriverWait wait = new WebDriverWait(driver,seconds); WebElement custumMenu= wait.until(ExpectedConditions.visibilityOfElementLocated(by)); return custumMenu; }
WebElement custumMenu=waitPageOpen(driver,By.xpath( "//aside/div/ul/li[2]/div[1]"),30);
//点击客户管理
custumMenu.click();