這可能是專家的簡單問題。我是一名初學者,現在我一直在試圖製作測試腳本來在腳本中打印頁面標題。以下是我的代碼的一部分:我無法打印頁面標題,然後進行驗證。有人可以幫忙嗎?Appium Android自動化
driver = new AndroidDriver<WebElement>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
System.out.println(driver.getRemoteAddress());
}
public void ApkPushValidation() throws Exception {
Assert.assertEquals("Verify your phone number", driver.findElementByName("Verify your phone number").getText());
driver.wait(5000);
String i = driver.getTitle();
System.out.println(i);
if (driver.getTitle().equals("Verify your phone number")) {
System.out.println("app installation is passed");
} else {
System.out.println("App installation is failed");
}
//System.out.println(i);---> my expectation is that this will print out Verify your Phone number. However this is not printing the page title.
你是說在按名稱查找元素之前添加一個driver.wait ?.如果是,那麼它也沒有工作。運行後,我的控制檯出錯: –
失敗:ApkPushTest org.openqa.selenium.WebDriverException:尚未實施。請幫助我們:http://appium.io/get-involved.html(警告:服務器未提供任何堆棧跟蹤信息) 命令持續時間或超時:16毫秒 –
您提供的日誌正在證實我的懷疑。此方法不適用於使用。 –