運行下面的代碼時,我收到了NoSuchElementException
。在IF語句中檢查`driver.findElement(...)`拋出`NoSuchElementException`
if (driver.findElement(By.xpath("//*[@id='gr2']")).isDisplayed()) {
Thread.sleep(5000);
driver.findElement(By.xpath("//*[@id='balInqTableStep2']/td/table/tbody/tr/td/table/tbody/tr[3]/td[4]/input[2]")).click();
}
else {
test.log(LogStatus.FAIL,"Please configure Gift Slabs for this site. Contact business.");
test.log(LogStatus.FAIL,"Second time wallet credit is not done");
}
你只是想讓我們知道這個信息,或者還有你要問一個問題嗎? – Andersson
你從哪裏得到例外? – Guy
而不是'絕對xpath',嘗試創建'相對xpath',然後再次檢查相同的條件。 –