level 1
网上大部分没有完整的例子。最主要的这行初始化代码:
初始化的代码显 式的声明配置成。UIAUTOMATOR2引擎,然后
利用下方try cacth 代码,就可以获取安卓的吐司信息了~
String toast="tost信息"
try {
final WebDriverWait wait = new WebDriverWait(driver,2
Assert.assertNotNull(wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(".//*[contains(@text,'"+ toast + "')]"))));
System.out.println("找到了toast");
} catch (Exception e) {
throw new AssertionError("找不到"+toast);
}
2018年06月13日 08点06分