简体   繁体   中英

How to handle alert or popup in Java appium automation

I have been automating the FB application, after login, I am getting this pop-up, how to handle this in appium using java.

脸书弹出窗口

You may need to use the Alert class like this.

Alert alert = driver.switchto().alert
alert.accept(); // This will click the allow button
alert.dismiss(); // Or use this to click Deny button

Or handle it from the id of the ok button.

driver.findElement(By.id(“android:id/ok_button”)).click();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM