how to handle alerts in android using appium

后端 未结 9 1897
野趣味
野趣味 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:23

    The best way is to use the appium inspector. Click on the element and copy the resource-id from it. Use this resource id in findElement(By.id()) method.

    For me resource-id: android:id/button1

    ((AndroidDriver) driver).findElement(By.id("android:id/button1")).click();
    

    This is for Android. For regular use you can use

    driver.findElement(By.id("android:id/button1")).click();
    

提交回复
热议问题