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.

Can't click on 'Allow' button on Notification popup at startup on IOS

See original GitHub issue

The problem

When appium starts my app, I get a system notification popup at start up, regarding allowing, or not allowing my app to send notifications. There’s two buttons to choose from: “Don’t Allow” and “Allow”. In my Test I want to click on “Allow”. But seems Appium ckicks on the wrong one. “Don’t Allow”.

Environment

  • Appium version: 1.6.3
  • Desktop OS/version used to run Appium: Mac OSX 10.12.3 (Sierra)
  • Node.js version: 7.5.0
  • Mobile platform/version under test: IOS 10.2.1
  • Real device is used
  • Appium CLI, using Java client.

Details

By looking at my app, this appears to happen (while debug stepping my test):

Appium clicks twice, first time on “Don’t Allow” button, which causes the popup to dissapear. Then appium clicks again (instantly) on the location where the “Allow” button was, which happens to be the location of a “connect to facebook” button on my app.

Additionally: my app always runs in Landscape mode

Link to Appium logs

Appium logs: https://gist.github.com/alexander-poulikakos/c2547ea4cf990d7f1d2d079b77075561

Appium doctor:

$ appium-doctor --ios 
info AppiumDoctor Appium Doctor v.1.4.1
info AppiumDoctor ### Diagnostic starting ###
info AppiumDoctor  ✔ The Node.js binary was found at: /usr/local/bin/node
info AppiumDoctor  ✔ Node version is 7.5.0
info AppiumDoctor  ✔ Xcode is installed at: /Applications/Xcode.app/Contents/Developer
info AppiumDoctor  ✔ Xcode Command Line Tools are installed.
info AppiumDoctor  ✔ DevToolsSecurity is enabled.
info AppiumDoctor  ✔ The Authorization DB is set up properly.
info AppiumDoctor  ✔ Carthage was found at: /usr/local/bin/carthage
info AppiumDoctor  ✔ HOME is set to: /Users/alexanderpoulikakos
info AppiumDoctor ### Diagnostic completed, no fix needed. ###
info AppiumDoctor 
info AppiumDoctor Everything looks good, bye!
info AppiumDoctor  

Code To Reproduce Issue [ Good To Have ]

IOSDriver<IOSElement> appium = ...;
System.out.println(appium.getPageSource()); // I have a break point here to ensure the Notifications popup is visible before continuing 
IOSElement allow = appium.findElementByName("Allow");
System.out.println(allow.getText()); // See printout in log for this
System.out.println(allow.getLocation()); // See printout in log for this
new TouchAction(appium).tap(allow).perform();

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:28 (1 by maintainers)

github_iconTop GitHub Comments

18reactions
mykola-mokhnachcommented, Feb 28, 2017

Try

driver.switchTo().alert().accept();
driver.switchTo().alert().dismiss();

methods to handle alerts

15reactions
valerybugakovcommented, Jan 8, 2018

I’ve resolved this issue using:

driver.execute('mobile:alert', { action: 'accept' });
Read more comments on GitHub >

github_iconTop Results From Across the Web

View and respond to notifications on iPhone - Apple Support
On the iPhone Lock Screen, view and respond to notifications of incoming messages, invitations, upcoming events, and more.
Read more >
Can't click on 'Allow' button on Notification popup at startup on IOS
The problem. When appium starts my app, I get a system notification popup at start up, regarding allowing, or not allowing my app...
Read more >
Appium in Web app: Unable to tap Allow permission button in ...
First: capabilities you were trying to use are for IOS only. On Android you have to find popup via findElement and close them...
Read more >
Nothing happens when clicking the Allow button on macOS in ...
Go to Apple menu > System Preferences... > Security & Privacy > Click the Allow button. Use the keyboard hit Allow (by hitting...
Read more >
Web Push notifications in Firefox - Mozilla Support
Web Push allows websites to notify users of new messages or updated ... a key on your keyboard or tap/click anywhere on the...
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