`driver.switch_to.alert.accept()` dismisses alert in iOS 9
See original GitHub issueUsing Appium v1.4.8 (REV 29b2c4d02dd4d41b91c08e0f4b25d24d32051d17) with Xcode 7b4 I find that calling driver.switch_to.alert.accept()
(Python bindings) results in the dialog being dismissed instead of accepted on the iOS 9 Simulator. This happens on iOS 9 only; the same setup but running the iOS 8.4 Simulator results in the expected behavior.
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
Unable to click on Alert with Selenium/Appium - Stack Overflow
It's a native iOS app that I'm working with. I've tried the following options: 1. driver.switchTo().alert().accept(); 2. driver.switchTo().alert ...
Read more >How to Automatically Dismiss Dialogs and Auto-Accept Alerts
Dialogs and alerts are annoying, but they can automatically dismissed and autoaccepted with a well-written Appium test script. Let's see how to do...
Read more >How to handle Alerts & Popups in Selenium | BrowserStack
Learn how to handle Alerts, Popups & Web Dialog Boxes in Selenium using the basic code examples. ... driver.switchTo().alert().accept();.
Read more >How to deal with custom system alerts - Appium Discuss
You can always identify an alert from iOS by the presence of an 'XCUIElementTypeAlert' element. ... driver.SwitchTo().Alert().Accept();.
Read more >How To Handle Alerts and Pop-ups In Selenium | Edureka
This method is called when the 'Cancel' button is clicked in the alert box. driver.switchTo().alert().dismiss();. 2) Void accept(). This method ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi guys,
I think I found the problem with the alert.
In the node_modules/appium-uiauto/uiauto/lib/mechanic-ext/alert-ext.js file you will find:
// iOS9.1 returns ‘cancel’ as the default button. if ((parseFloat($.systemVersion) >= 9.1 && buttonCount > 0) ||
The problem here is that cancel is also default on iOS 9.0v so the right code should be
// iOS9.0 returns ‘cancel’ as the default button. if ((parseFloat($.systemVersion) >= 9.0 && buttonCount > 0) ||
This fixed the issue for me 😄
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.