public void permission() {
for (int i=0; i <= 10; i++) {
if (getPageSource().contains("允许") || getPageSource().contains("禁止")
|| getPageSource().contains("授权")) {// 出现权限提示
try {
findElement(By.xpath("//android.widget.Button[contains(@text,'允许')]")).click();// 点击允许
} catch (NoSuchElementException e1) {
findElement(By.xpath("//android.widget.Button[contains(@text,'授权')]")).click();// 点击授权
}
} else {
break;
}
}
}

相关文章:

  • 2021-09-01
  • 2022-01-14
  • 2021-04-06
  • 2021-11-10
猜你喜欢
  • 2021-09-13
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
相关资源
相似解决方案