在等待预期的情况时,我们可以继续点击搜索按钮吗?
int time_out = 0;
while (driver.findElement(By.xpath("//*[@id='searchResults']/p/span")).isDisplayed() &&time_out != 20 )
{
if(!driver.findElement(By.xpath("//*[@id='searchResults']/div[1]/div[1]/*")).isDisplayed())
{
driver.findElement(By.xpath(".//*[@id='searchItem']")).click();
Thread.sleep(3000);
time_out++;
}
else
{
//click on the activation code
driver.findElement(By.xpath((".//*[@id='searchResults']/div[1]/div[1]/*"))).click();
}
}
我尝试了这个,但不知何故不起作用。