【发布时间】:2018-04-14 22:35:09
【问题描述】:
gmail 的 passwordNext 按钮并不总是有效。显式等待似乎也无济于事。
public void funcLogin() {
driver.findElement(LoginMail).sendKeys(prop.getProperty("email"));
driver.findElement(LoginMail).sendKeys(Keys.RETURN);
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
driver.findElement(PwdMail).sendKeys(prop.getProperty("passwd"));
driver.manage().timeouts().implicitlyWait(40, TimeUnit.SECONDS);
driver.findElement(By.id("passwordNext")).click();
driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
}
错误:
org.openqa.selenium.WebDriverException: unknown error: Element <div role="button" id="passwordNext" class="O0WRkf zZhnYe e3Duub C0oVfc nDKKZc DL0QTb" jscontroller="VXdfxd" jsaction="click:cOuCgd; mousedown:UX7yZ; mouseup:lbsD7e; mouseenter:tfO1Yc; mouseleave:JywGue;touchstart:p6p2H; touchmove:FwuNnf; touchend:yfqBxc(preventMouseEvents=true|preventDefault=true); touchcancel:JMtRjd;focus:AHmuwe; blur:O22p3e; contextmenu:mg9Pef;" jsshadow="" jsname="Njthtb" aria-disabled="false" tabindex="0">...</div> is not clickable at point (787, 340). Other element would receive the click: <div class="ANuIbb IdAqtf" jsname="k4HEge" tabindex="0"></div>
【问题讨论】:
-
你不必每次都重写隐式等待,一旦写好它就会应用到你调用
findElement方法的任何人 -
你在哪里写了显式等待的代码?
标签: java selenium selenium-webdriver gmail