Not able to run on test using appium on real device

Posted my Logs and detailed issue -

Can you add tags to your post? It helps alot, thanks.

1 Like

Hmm, try setting the autoWebview desired capability to false, and manually switch to the webview after safari has finished launching…

Can you turn on logging (start the server with --show-ios-log) and attach a gist of the logs here? Also, is this iOS 6 (as here), or 7.1 (as in the issue on Github)?

My first inclination is to see if SafariLauncher is built and provisioned correctly.

Hi Issac, Thanks for your response :
Please find below the details of device and logs :

Platform - IOS 7.1
Appium version - 1.2.2
Real Device - Iphone 5s

Below are my code for running the test on real device :

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“deviceName”, “iPhone”);
AppiumDriver driver = null;
driver = new AppiumDriver(new URL (“”), capabilities);
driver.get(“I am a page title - Sauce Labs”);

Server Logs : I started server with command :
node main.js -U d9b0a44696c83e2d96fa2feba905f5745XXXXXXX --show-ios-log

info: Welcome to Appium v1.2.2 (REV 9c034a5732eae988bf9c06ed13ae6e5036a5b428)
info: Appium REST http interface listener started on
info: [debug] Non-default server args: {“udid”:“d9b0a44696c83e2d96fa2feba905f574589e47f1”,“showIOSLog”:true}
info: LogLevel: debug
info: → POST /wd/hub/session {“desiredCapabilities”:{“platformName”:“iOS”,“deviceName”:“iPhone”,“browserName”:“safari”}}
info: [debug] Configuring Safari session
info: [debug] Using local .zip from command line: /Users/srivasts/ImpBackups/MobileAutomation/appium/appium/build/SafariLauncher/
info: [debug] Copying local zip to tmp dir
info: [debug] /Users/srivasts/ImpBackups/MobileAutomation/appium/appium/build/SafariLauncher/ copied to /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/
info: [debug] Unzipping /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/
info: [debug] Testing zip archive: /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/
info: [debug] Zip archive tested clean
info: [debug] Unzip successful
info: [debug] Using locally extracted app: /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/submodules/SafariLauncher/build/Release-iphoneos/
info: [debug] Creating new appium session ab976849-dade-4a89-a16d-855e7aafa25c
info: [debug] Removing any remaining instruments sockets
info: [debug] Cleaned up instruments socket /tmp/instruments_sock
info: [debug] Setting Xcode folder
info: [debug] Setting Xcode version
info: [debug] Setting iOS SDK Version
info: [debug] iOS SDK Version set to 7.1
info: [debug] Detecting automation tracetemplate
info: [debug] Not auto-detecting udid, running on sim
error: Could not parse plist file (as binary) at /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/submodules/SafariLauncher/build/Release-iphoneos/
info: Will try to parse the plist file as XML
parseFileSync() is deprecated. Use parseStringSync() instead.
error: Could not parse plist file (as XML) at /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/submodules/SafariLauncher/build/Release-iphoneos/
warn: Could not parse app Localizable.strings
info: [debug] Not setting locale because we’re using a real device
info: [debug] Creating instruments
info: [debug] Preparing uiauto bootstrap
info: [debug] Dynamic bootstrap dir: /Users/srivasts/Library/Application Support/appium/bootstrap
info: [debug] Dynamic env: {“nodePath”:“/Users/srivasts/ImpBackups/MobileAutomation/homebrew/Cellar/node/0.10.31/bin/node”,“commandProxyClientPath”:“/Users/srivasts/ImpBackups/MobileAutomation/appium/appium/node_modules/appium-uiauto/bin/command-proxy-client.js”,“instrumentsSock”:“/tmp/instruments_sock”,“interKeyDelay”:null}
…o: [debug] Dynamic bootstrap code: // This file is automatically generated. Do not manually modify!
info: [debug] Dynamic bootstrap path: /Users/srivasts/Library/Application Support/appium/bootstrap/bootstrap-98d71b7c2314c59a.js
info: [debug] Reusing dynamic bootstrap: /Users/srivasts/Library/Application Support/appium/bootstrap/bootstrap-98d71b7c2314c59a.js
info: [debug] Fixing device was changed from:"
info: [debug] Not setting iOS and app preferences since we’re on a real device
info: [debug] Starting iOS device log capture via deviceconsole
info: [debug] Not setting device type since we’re connected to a device
info: [debug] Getting bundle ID from app
info: [debug] Parsed app Info.plist (as binary)
info: [debug] Checking app install status using: /Users/srivasts/ImpBackups/MobileAutomation/appium/appium/build/fruitstrap/fruitstrap isInstalled --id d9b0a44696c83e2d96fa2feba905f574589e47f1 --bundle com.bytearc.SafariLauncher
info: [debug] Not starting command proxy since we’re expecting that Instruments won’t be able to talk to it anyway
info: [debug] Instruments is at: /Users/srivasts/Softwares/
info: Launching instruments
info: [debug] Attempting to run app on real device with UDID d9b0a44696c83e2d96fa2feba905f574589e47f1
info: [debug] Spawning instruments with command: /Users/srivasts/Softwares/ -t /Users/srivasts/Softwares/ -D /tmp/appium-instruments/instrumentscli0.trace -w d9b0a44696c83e2d96fa2feba905f574589e47f1 /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/submodules/SafariLauncher/build/Release-iphoneos/ -e UIASCRIPT /Users/srivasts/Library/Application Support/appium/bootstrap/bootstrap-98d71b7c2314c59a.js -e UIARESULTSPATH /tmp/appium-instruments
info: [debug] And extra without-delay env: {}
info: [debug] And launch timeouts (in ms): {“global”:90000}
info: [debug] [INST] 2014-09-03 09:32:44 +0000 Error: Script threw an uncaught JavaScript error: Error getting next command, shutting down Sudhanshu :frowning: on line 2581 of bootstrap-98d71b7c2314c59a.js

info: [debug] [INST] 2014-09-03 09:32:44 +0000 Stopped: Script was stopped by the user

info: [debug] [INST] Instruments Trace Complete (Duration : 2.244201s; Output : /tmp/appium-instruments/instrumentscli0.trace)

info: [debug] [INSTSERVER] Instruments exited with code 0
info: [debug] Cleaning up after instruments exit
info: [debug] Not worrying about instruments exit since we’re using SafariLauncher
info: [debug] Instruments launched. Starting poll loop for new commands.
info: [debug] Not setting bootstrap config because we’re on SafariLauncher
info: [debug] Not setting initial orientation because we’re on SafariLauncher
info: [debug] Navigating to most recently opened webview
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
warn: Could not find any webviews yet, retrying
info: [debug] [REMOTE] Getting WebKitRemoteDebugger pageArray
info: [debug] Cleaning up appium session
error: Failed to start an Appium session, err was: Error: Could not navigate to webview; there aren’t any!
info: [debug] Error: Could not navigate to webview; there aren’t any!
at null. (/Users/srivasts/ImpBackups/MobileAutomation/appium/appium/lib/devices/ios/ios.js:1517:12)
at null. (/Users/srivasts/ImpBackups/MobileAutomation/appium/appium/lib/devices/ios/ios-controller.js:1516:5)
at null. (/Users/srivasts/ImpBackups/MobileAutomation/appium/appium/lib/devices/ios/webkit-remote-debugger.js:88:5)
at /Users/srivasts/ImpBackups/MobileAutomation/appium/appium/node_modules/underscore/underscore.js:754:19
at IncomingMessage. (/Users/srivasts/ImpBackups/MobileAutomation/appium/appium/lib/devices/ios/webkit-remote-debugger.js:101:7)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickDomainCallback (node.js:463:13)
info: [debug] Responding to client with error: {“status”:33,“value”:{“message”:“A new session could not be created. (Original error: Could not navigate to webview; there aren’t any!)”,“origValue”:“Could not navigate to webview; there aren’t any!”},“sessionId”:null}
info: ← POST /wd/hub/session 500 21845.886 ms - 218
warn: Instruments socket client never checked in; timing out (global)
info: [debug] Killall instruments

Thanks for your reply.

Manually Switch to Webview… you mean to say manually launch the Safari browser on device ?

Once i start my test, it launches the SafariLauncher on my device but stops and exits in next second. On manually launches the Safari browser, I am getting below error in logs (attachedLogs.log (16.9 KB) )

indent preformatted text by 4 spaces

I added tags to the top of your post. You should always include these with your first post, it helps us figure out the problem faster :slight_smile:

What happens if you run instruments on its own?

/Users/srivasts/Softwares/ -t /Users/srivasts/Softwares/ -D /tmp/appium-instruments/instrumentscli0.trace -w d9b0a44696c83e2d96fa2feba905f574589e47f1 /var/folders/rg/64s_pq3s0jjdn_0ttkb5m5x51wrl5_/T/11483-41357-m5ae2d/submodules/SafariLauncher/build/Release-iphoneos/ -e UIASCRIPT /Users/srivasts/Library/Application Support/appium/bootstrap/bootstrap-98d71b7c2314c59a.js -e UIARESULTSPATH /tmp/appium-instruments

@Isaac, When i restart my device and run the test then it launches the app on my device and execute the test on safari browser on Mobile. But the second time when i run, it opens the app but quit in the next second.

So seems like, when i restart my device somethings happens :slight_smile: which doesn’t second time

When i run the above command it shows me message

2014-09-04 21:24:37.144 instruments[69951:707] Argument ‘UIASCRIPT’ does not point to a valid script. Using script defined in template.
Instruments Trace Complete (Duration : 1.114803s; Output : /tmp/appium-instruments/instrumentscli0.trace)

Seems like second time it is not able to find any WEBVIEW causing test to fail

Here the Complete steps to run scrpits in real device(iOS & Android):


Step 1: Download Android SDK Bundle

            Download Link for your reference:

            Screenshot for your reference:

Step 2:
Once download completed , extract the .rar file and open the folder you can see SDK folder . Copy the path of this SDK folder.
Now, open the environmental variables in the windows properties and create user variables in that environment variables window with the exact name of “ANDROID_HOME” and value textfield you enter the SDK folder path.
Screenshot for your referenece:

            Return back to android sdk bundle folder . Open the sdk folder you can see platform-tools folder and tools folder . Just copy these two folder path and add it in your environmental variables path.

            Screenshot for your referenece:

Step 3:Once setup done for android SDK bundle. Connect your android device.

            Note: Android Composite ADB Interface should be installed otherwise it will not work.
            Screenshot for your reference:

            Open the command prompt and type "adb devices" you can see the list of devices attached. If you got any error or did not show the devices list that you may mistake or missed  steps to setup andorid SDK bundle or device.

Step 4:Once android device successfully connected. You can enable the USB debugging mode in the settings of android device.

            Screenshot for your reference:

Step 5:

           Once setup done, Go to url and download the appium latest version and extract the .rar file and then open the appium.exe and then launch the appium server.
            Here the screenshot of appium server for your reference: 


Minimum iOS Requirements
• Mac OS X 10.7 or higher, 10.8.4 recommended
• XCode >= 4.6.3
• appium-0.18.0

Step 1:
To install the latest tagged version of the ios-webkit-debug-proxy using brew, run the following commands in the terminal:

The first command is only required if you don’t have brew installed.

ruby -e “$(curl -fsSL”
brew update
brew install ios-webkit-debug-proxy
You can also install the latest proxy by cloning it from git and installing it yourself:

Please be aware that this will install the proxy with the latest code (and not a tagged version).

git clone GitHub - google/ios-webkit-debug-proxy: A DevTools proxy (Chrome Remote Debugging Protocol) for iOS devices (Safari Remote Web Inspector).
cd ios-webkit-debug-proxy
sudo make install
Once installed you can start the proxy with the following command:

Change the udid to be the udid of the attached device and make sure to set the port to 27753

as that is the port the remote-debugger uses.

ios_webkit_debug_proxy -c deviceUDID:27753 -d
Step 2:
Install the WebViewApp application in your iOS device.
I have attached the WebViewApp rar file. Please download and extract it and open the application folder using xcode.
Here the example how to install application in real iOS device using xcode.
• An iOS Development Device (iPhone, iPodTouch, or iPad)
Step 1: Login to the iPhone Provisioning Portal
Login to your Apple Developer account by navigating to iOS 17 - Apple Developer. Once there, navigate to the iPhone Provisioning Portal.

        Step 2: Install the WWDR Intermediate Certificate
        The first thing we will need to do is download the WWDR Intermediate Certificate. Once in the portal, click on “Certificate” in the sidebar and you will be presented with a link to download the “WWDR Intermediate Certificate.”

        Download the file and double-click to add it into the Keychain Access program on Mac OS.
        Step 3: Create a Development Certificate
        Next, we will need to download a certificate for development. To get the development certificate, we will need to generate a “Certificate Signing Request” from within Keychain Access.
        Open the Keychain Access program on your mac. It can be found under Applications > Utilities > Keychain Access, or just by searching for “Keychain Access” with Spotlight.

        Once open, go into the “Keychain Access” drop-down menu in your menubar and select “Certificate Assistant” and then “Request Certificate from A Certificate Authority.”

        A window will popup. Fill the window in with your information, but leave “CA Email Address” blank, and select “Save To Disk” from the radio buttons. Save it to a location that is easy to find, like your desktop, because you will need the file shortly to generate the certificate.

        Head back into the “Certificate” section of the Provisioning Portal and make sure you have selected the “Development” tab. From there, press “New Certificate” and upload the request you made on your desktop. You may need to refresh the page in a few moments to change the status from “Pending” to available for download. If you are working as a team member on a larger project, you may need your manager to approve the certificate request.
        Hopefully all went well, and you were able to create a certificate. Go ahead and download the certificate, then install it by double clicking the file or, if Keychain Access is open, drag the file over the Keychain Access icon in the dock.
        Step 4: Create an App ID
        Next we need an App ID. Return to the Provisioning Portal and select the “App IDs” option from the menu on the left.
        There are two distinct App ID types to choose from.
        One approach is to create an App ID for a single application. This will allow you to enable advanced features like In-App Purchases, Game Center integration, or Push Notifications. To do this approach, structure the bundle identifier as follows:
  1.  com.companyname.AppName  

If you would like to create an App ID for a single application, fill out the screen as displayed:

        The second approach is called a wildcard bundle ID. This approach will allow you to create an App ID that can be used for multiple applications that you would like to share a keychain between.

To take this approach, fill out the form as displayed:

        Step 5: Find & Add Your Device UDID
        Select the “Devices” link from the left menu in the “Provisioning Portal.”
        In-order to add a device, you will need the device’s unique device identifier, also known as the UDID.

To get the UDID, plug the device into iTunes and select your device in the list. In the device’s “Summary” tab, there will be a description called “Serial Number” next to the picture of the device. Click once on the serial number and it should change to “Identifier”, or your UDID. Copy your UDID to the clipboard. (Command + C on Mac/Control + C on Windows)

        Another approach is to simply download one of the many free “UDID” applications in the App Store, and e-mail or copy the UDID from that app.

After you have your UDID, click on add device from within the devices tab in the Provisioning Portal. Enter a name under “Device Name” and enter the UDID under “Device ID”.

        Step 6: Create & Download Provisioning Profile
        Now that you have added your device and made an App ID, we can generate a provisioning profile.
        Select the “Provisioning” tab from the left menu. Make sure that the “Development” tab is selected, and click the “New Profile” button.
        I named my new Profile “Developer”. Under certificate choose your development certificate, and under App ID, choose the ID we made in step 2. Under devices, select all the devices you have that you are going to use for development.
        Press “Submit” to be brought back to the overview page for provisioning. Once on this page, if the status is set to “pending” you will need to refresh your browser before being able to select “Download.” If you are a team member on another’s account, you may need to wait for them to approve your certificate creation request. Download the certificate to continue.

        Step 7: Install Provisioning Profile
        In this step, we will install the profile to your device and to Xcode.
        Make sure your device is connected, and from your downloads folder drag the Provisioning Profile onto the Xcode icon.

        Then go into Xcode and open the organizer by going to Window > Organizer. There you should see your devices name on the left. Click on your device that has a green dot next to it and make sure          it is allowed to be used for development, by clicking on “Use for Development” if it presents itself.
        In the device summary info you should see a table called “Provisioning”. Drag and drop the provision profile from your downloads folder into that as well.
        Step 8: Configure Build Settings
        In this step, you will build your application to run on your device.
        In your Xcode project, open the info.plist file from the “Groups & Files” pane. Fill in the “Bundle Identifier” value with the one created earlier and associated with the App ID.

        Finally, select Project > Edit Project Settings from the Xcode menu bar or just right click or control click on the project file as shown below:

        A new window should open. Select the “build” tab on this window.
        Scroll down to the “Code Signing” section and select the correct provisioning profile identity from the drop down menu associated with the iOS device.
        Step 9: Run On Device
        Before you build and run, be sure to select “Device” from Project > Set Active SDK in the Xcode menu bar. Also be sure that you have selected the correct device from Project > Set Active   Executable. Finally, be sure that your iOS device is turned on, connected to your computer, that it is recognized by iTunes, and that your screen is not locked.
        You should now be ready to build, install, and run your first application on your iOS hardware! Click the “Build & Run” icon, and Xcode should take care of the rest.

Once setup is done, launch the appium server.
Here the screenshot of appium server for your reference:

In BundleID text field in appium server, type the bundle id of the WebViewApp.
In UDID text field in appium server, type the IOS device UDID .
Test Automation


Great tutorial. Do you want to repost is as a specific Tutorial post so others can learn from it?