问题二:appium 搞定权限弹框的一个小办法

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;
}
}
}

原文地址:https://www.cnblogs.com/kaola8023/p/10908491.html