本文整理匯總了Java中org.openqa.selenium.WebDriver.getTitle方法的典型用法代碼示例。如果您正苦於以下問題:Java WebDriver.getTitle方法的具體用法?Java WebDriver.getTitle怎麽用?Java WebDriver.getTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.openqa.selenium.WebDriver
的用法示例。
在下文中一共展示了WebDriver.getTitle方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: test
import org.openqa.selenium.WebDriver; //導入方法依賴的package包/類
@Ignore
@Test
public void test() throws IOException {
Map<String, String> baseState = new HashMap<>();
baseState.put("type", "MOBILE");
baseState.put("connectionString", "platformName=Android;app=C:\\apps\\InsuranceMobile.apk");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("appdriver-basestate", baseState);
WebDriver driver = new RemoteWebDriver(new URL("http://localhost:8080"), capabilities);
String title = driver.getTitle();
assertEquals("", title); // TODO: Maybe we find something to use as the
// title?
WebElement email = driver
.findElement(By.xpath("//MobileTextField[@resource-id='silktest.insurancemobile:id/email']"));
email.sendKeys("test");
assertEquals("test", email.getText());
email.clear();
assertEquals("", email.getText());
email.sendKeys("[email protected]");
driver.findElement(By.xpath("//MobileTextField[@resource-id='silktest.insurancemobile:id/password']"))
.sendKeys("john");
driver.findElement(By.xpath("//MobileButton[@resource-id='silktest.insurancemobile:id/log_in_button']"))
.click();
driver.findElement(By.xpath("//MobileObject[@content-desc='drawer_open']")).click();
driver.findElement(By.xpath("//MobileObject[@caption='Logout']")).click();
driver.quit();
}