なぜ私のwebdriverメソッドは、要素が表示されるまで '最大タイムアウト'まで待つのですか?なぜ私のwebdriverメソッドは要素が表示されるまで 'Max timeout'まで待つのですか?
マイ方法:
public boolean WaitUntilWebElementIsVisible(WebElement element) {
try {
WebDriverWait tempWait = new WebDriverWait(driver, 30);
tempWait.pollingEvery(100, TimeUnit.MILLISECONDS);
tempWait.until(ExpectedConditions.visibilityOf(element));
System.out.println("WebElement is visible using locator: " + element.toString());
return true;
} catch (Exception e) {
System.out.println("WebElement is NOT visible, using locator: " + element.toString() + " ,Exception: " + e.getMessage());
Assert.fail("Method failed: WaitUntilWebElementIsVisible");
//Assert.fail("WebElement is NOT visible, using locator: " + element.toString());
return false;
}
}
TestNGの呼び出し:
@Test(priority = 27)
public void confirm_BillingAddress_Header_IsVisible_BillingAndPaymentDetails_Section() throws Exception {
//Verify whether the panel title: 'BILLING ADDRESS:' is visible
Thread.sleep(1000);
basePage.WaitUntilWebElementIsVisible(checkoutPage.subheader_BillingAddress);
Assert.assertEquals(checkoutPage.subheader_BillingAddress.getText(), "BILLING ADDRESS:");
}
号の実施例(試験中にヘッダが容易30秒前に表示される):
これは、Webドライバ待機のためではない可能性があります。ドライバ取得メソッドを使用したURL起動である前のステップになることがあります。完全にロードされるまで待機します。その後、ヘッダーの表示を確認することがあります。タイムアウト例外が出ますか? – Murthi
どのようなエラーが表示されますか?例外トレースを共有できますか? – Mahipal