Reputation: 21
Appium v1.6.4-beta Xcode 8.2 macOs Sierra 10.12
I want to automate to save photo in my device. But in first time I have to give permission. I have used "accept alert", but cannot accept the alert for allow to access the photo library. It shows the test passed in green , when I execute the test, but this popup still appear in view and photo is not saved.
This is my script
//Check Save
driver.findElement(By.id("Save")).click();
driver.switchTo().alert().accept();
Capabilities also used ,
capabilities.setCapability("autoAcceptAlerts", true);
This is what I want to allow
How to accept this alert? I have tried with xpath sa well, but no luck
Upvotes: 1
Views: 5995
Reputation: 1194
Below code will work.Give it a try with "OK" and "Ok". This is because if you want to try to identify the element with the text you can use accessibilityID or ID.
driver.findElement(By.id("OK")).click();
Below code won't work for alerts coming in mobile automation like web alerts.
driver.switchTo().alert().accept();
Upvotes: 3