我有一個web應用程序,我按下提交按鈕,直到數據可用的表。當我沒有數據可用,然後提交按鈕隱藏。因此,我們可以得到邏輯,直到提交按鈕隱藏,我們將click.and當按鈕不可用時,我們會顯示成功消息並加載下一個瀏覽器的網址。單擊webelement直到隱藏
for (k=0;k>30;k++) {
try {
driver.findElement(By.xpath(".//*[@id='content']/input")).click();
driver.switchTo().alert();
driver.switchTo().alert().accept();
Thread.sleep(20000);
} catch (org.openqa.selenium.NoSuchElementException e){
System.out.println(""+location+" Done");
}
}
這裏driver.findElement(By.xpath(".//*[@id='content']/input")).click();
此行點擊我提交button.And後提交一個瀏覽器的警報顯示這就是爲什麼我接受這一點。在這個循環for (k=0;k>30;k++)
盲目我把30..Is有任何邏輯或如何管理這個任何sugggestion ...
如何使用do-while循環以刪除「30」計數器的需要?在while循環中,使用ExpectedCondition.invisibilityOf(btn)(!ExpectedCondition.invisibilityOf)的虛假性作爲布爾標誌,以在按鈕不可見時退出循環。刪除thread.sleep並在預期的條件中使用等待時間。 – Grasshopper