As there are a lot of us facing issues with Safari browser automation, I wanted to document the steps that
help the members to do the browser automation.
Pre-requisites:
a. Xcode installed on Mac OS X.
b. Device added to Apple developer program
c. Get SafariLauncher.app(https://github.com/budhash/SafariLauncher)
d. Launch the SafariLauncher.app on connected device from Xcode.
e. Install appium (IDE)
f. Download appium from github (https://github.com/appium/appium)
g. Install ios-webkit-debug-proxy … use below command from terminal. Install brew install ios-webkit-debug-proxy
a. Connect the device to your mac and verify the device is shown under Xcode
b. Launch the app on device from xcode
Open appium IDE, add your device details as mentioned in the below screen.
Open new terminal window and navigate to your cloned appium source and
run the command ./bin/ios-webkit-debug-proxy-launcher.js -cUDID -d (This is workaround for dubug proxy crash)
Hi @Mobile_Test_Test ,
We are also doing automation on real device on iOS on safari, but test execution is not stable. We face issues with stale tabs which remain in the browser in case a script fails. Now we are facing an issue when we try to click an element which opens a new tab. As soon as new tab is opened we see an issue in appium server- The target application appears to have died. Do you have any idea about this issue ?
I have gone through the above the Pre-requisites and I have done the same set up but I got stuck @ one step.
These things I have already done - SafariLauncher is installed via XCODE on IPAD Mini Air (9.3) and device is also connected using os-webkit-debug-proxy.
But when I am running test I am getting below exception
info: [debug] Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
at Error (native)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’)”,“errno”:-2,“code”:“ENOENT”,“path”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip",“origValue”:“ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’”},“sessionId”:null}
error: Failed to start an Appium session, err was: Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
info: <-- POST /wd/hub/session 500 162.301 ms - 498
Friends, I did all my setup. That is setting up Safari Launcher and webkit proxy as well. The problem is when I start the test Safari Launcher starts and opens up the browser but no URL launches. Just the apple.com page launches.
Hey @yukonpd, you should launch the url from your test scripts, not the SafariLauncher.
If you would like to change the first launched page from the SafariLauncher, you should open it with Xcode and change the Default Value of Root.plist
Hi, I am facing issue with safari on real device. SafariLauncher opens the safari browser on device but did not hit my URL.
set following capabilities
deviceUDID= xxxxxx
bundleid= com.apple.mobilesafari
appium-version =1.4.11
browserName =Safari
platformName =iOS
deviceName =iPhone 6
platformVersion =8.4
I got the same error which you were getting earlier, could you please confirm whether you got a solution for this.
info: --> POST /wd/hub/session {“desiredCapabilities”:{“appium-version”:“1.4.13”,“platformName”:“iOS”,“deviceName”:“Bin_iPhone”,“udid”:“1f789643be7b96813c4d2ae5b037bc27cb1b4a26”,“bundleId”:“com.binoy.safarilauncher”,“browserName”:“safari”,“version”:“8.4.1”}}
info: Client User-Agent string: undefined
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: **** NEW SESSION ***
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: *************************************
info: [debug] The following desired capabilities were provided, but not recognized by appium. They will be passed on to any other services running on this server. : appium-version, version
error: Failed to start an Appium session, err was: Error: ENOENT, stat '/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
info: [debug] Configuring Safari session
info: [debug] Using local .zip from command line: /Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip
info: [debug] Copying local zip to tmp dir
info: [debug] Got configuration error, not starting session
info: [debug] Cleaning up appium session
info: [debug] Error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’
at Error (native)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’)”,“errno”:-2,“code”:“ENOENT”,“path”:"/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip",“origValue”:“ENOENT, stat ‘/Applications/Appium.app/Contents/Resources/node_modules/appium/build/SafariLauncher/SafariLauncher.zip’”},“sessionId”:null}
info: <-- POST /wd/hub/session 500 4.849 ms - 498