Can't click Allow button in permission dialog in Android using Appium

后端 未结 5 1799
予麋鹿
予麋鹿 2021-02-08 21:30

I am unable to tap on Deny or Allow buttons on the permissions dialog in Android using Appium+Java. Do I need to add any capabilities before going to tap on those buttons? Below

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-08 22:24

    With the below snippet I am able to click on all the allow buttons to get the permissions.

    while (driver.findElements(MobileBy.xpath("//*[@class='android.widget.Button'][2]")).size()>0) {
        driver.findElement(MobileBy.xpath("//*[@class='android.widget.Button'][2]")).click();
    }
    

提交回复
热议问题