要求:在我们的应用程序中,当我单击扫描按钮时,状态将为“进行中”。我应该一直点击“刷新按钮”,“停止”状态变为“时间,日期,年份”,这意味着扫描已经完成。下面是我编写的一段代码,但它不起作用。
public void verifyScanComplete(String networkName)
{
int i=0;
try{
//here I am searching for the string "In Progress" in the page
List<WebElement> stopStatus = driver.findElements(By.xpath("//*[text()='In Progress']"));
//this is the element stop status which will change from "In Progress" to "dd/mm/yy"
WebElement stopStatusChanged = driver .findElement(By.xpath("//*[@id='div_scan_set']/form/div/table/tbody/tr/td[text()='"+networkName+"']/../td[10]"));
while ((stopStatusChanged.getText().contains("In Progress")))
{
WebUtils.sleep(40000);
driver.navigate().refresh();
i++;
}
}
catch (Exception e) {}
}