question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`driver.switch_to.alert.accept()` dismisses alert in iOS 9

See original GitHub issue

Using 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:closed
  • Created 8 years ago
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
eugenlucacommented, Sep 29, 2015

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 😄

0reactions
lock[bot]commented, Oct 24, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found