how to handle alerts in android using appium

后端 未结 9 1898
野趣味
野趣味 2020-12-11 08:18

How do I handle alerts in an Android web application using Appium server (1.0.1) and the Android SDK?

The below code is not working on android:

drive         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-11 08:24

    So an updated answer on this is this: an AlertDialog is a system level element, so clicking on accept button you should use:

    androidDriver.findElementById("android:id/button1").click()
    

    else for cancel do this:

    androidDriver.findElementById("android:id/button2").click()
    

提交回复
热议问题