Pri*_*nce 3 gwt selenium gwt2 selenium-server selenium-webdriver
在UiBinder中为GWT小部件设置'id'.
例如.
还添加了 在*.gwt.xml中
然后我在Selenium测试用例中尝试这个
WebElement element = driver.findElement(By.id("gwt-debug-loginButton"));
Run Code Online (Sandbox Code Playgroud)
有时它工作正常.但有时会抛出以下异常,
无法定位元素:{"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
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1412 次 |
| 最近记录: |