Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Appium and Selenium fail to connect when "Use current location" permission popup appears

I am attempting to automate iOS testing with Appium. I have an app that requires user location and requests location permission on first launch. When I try to connect selenium to a fresh install, it fails when the popup appears. When I manually accept the popup, Seleium and Appium connect without fail and the test is able to continue.

This is a copy of the server output:

error: Instruments did not launch successfully, failing session
error: Failed to start an Appium session, err was: Instruments did not launch successfully--please check your app paths or bundle IDs and try again
info: Responding to client with error: {"status":6,"value":{"message":"A session is either terminated or not started","origValue":"Instruments did not launch successfully--please check your app paths or bundle IDs and try again"},"sessionId":"faccc84b-fa8e-4137-ad77-f0c79d09b045"}
POST /wd/hub/session 500 13605ms - 270
debug: - - - "POST /wd/hub/session HTTP/1.1" 500 270 "-" "Ruby"
info: Clearing out appium devices

and a copy of the selenium output:

Selenium::WebDriver::Error::NoSuchDriverError:
       A session is either terminated or not started

and I am initializing Selenium with the following command:

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

Any help is appreciated!

like image 465
Nick Isaacs Avatar asked Oct 04 '22 09:10

Nick Isaacs


1 Answers

There has been an appium update for this. Simply add the capability to always accept these alerts to avoid failures anywhere in the app. Java example:

        capabilities.setCapability("autoAcceptAlerts", true);
like image 134
plosco Avatar answered Oct 13 '22 11:10

plosco