本文整理汇总了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();
}