T 在 UiBinder 本身中为 GWT 小部件设置“id”。
For eg.
还添加了在 *.gwt.xml 中
然后我在 Selenium 测试用例中尝试这个
WebElement element = driver.findElement(By.id("gwt-debug-loginButton"));
有时它可以正常工作。但有时它会抛出以下异常,
无法定位元素:
{"method":"id","selector":"gwt-debug-loginButton"} 命令持续时间或
超时:62 毫秒
我需要更新什么?
谁能帮我?
使用WebDriverWait,在一段时间后搜索元素。像这样的东西。
try {
(new WebDriverWait(driver, seconds, delay)).until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver d) {
try {
WebElement el = d.findElement(By.id("gwt-debug-loginButton"));
return true;
} catch (Exception e) {
return false;
}
}
});
} catch (TimeoutException t) {
//Element not found during the period of time
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)