【发布时间】:2017-06-27 20:39:35
【问题描述】:
需要我的问题的答案。
在我的测试脚本中,我试图接受警报,然后表格应该在接受警报后加载,但同样的事情没有发生。由于表格未加载,我收到以下错误:-
org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"xpath","selector":"//table[contains(@id,'Content_gvSelectSeats')]/tbody "} (会话信息:chrome=58.0.3029.110)
这是同步问题吗??
下面的一段代码:-
1) 点击获取
reallocate.getReallocateclickFetch(); // 简单点击按钮
2) 现在微调器将移动并且警报来了 // 等待警报并接受它
public boolean WaitUntilAlertLoad()
{
boolean foundAlert = false;
WebDriverWait wait = new WebDriverWait(driver, 30 /*timeout in seconds*/);
do {
for(int i=0;i<100;i++)
{
try {
wait.until(ExpectedConditions.alertIsPresent());
foundAlert = true;
driver.switchTo().alert().accept();
} catch (Exception e) {
foundAlert = false;
}
if(i==99)
{
break;
}
}
}while(foundAlert=false);
return foundAlert;
}
但是在接受警报表之后仍然没有加载。我该怎么办??
【问题讨论】:
标签: selenium