3

I am trying to automate mobile web testing using ios-driver. The safari browser does not open even though the simulator launches.

The configuration as shown on terminal by running the command java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar -newSessionTimeoutSec 40 -port 5555 is:

Running on: Mac OS X 10.10 (x86_64)
Using java: 1.8.0_45
Using Xcode install: /Applications/Xcode.app
Using instruments: version:6.3.2, build: 57082
Using iOS version 8.3
iOS >= 6.0. Safari and hybrid apps are supported.
Applications :
CFBundleName=Safari,CFBundleVersion=600.1.4,/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator8.3.sdk/Applications/MobileSafari.app

The Java code I used is as follows:

DesiredCapabilities caps = IOSCapabilities.iphone("Safari");
caps.setCapability(IOSCapabilities.SIMULATOR, true);
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://localhost:5555/wd/hub"), caps);
driver.get("http://www.google.com/");

The following lines are displayed on terminal:

59:05:611 WARNING InstrumentsCommandLine.start instruments crashed (40 SEC)
59:06:040 WARNING NewSessionNHandler.safeStart Instruments failed to start in the allocated time ( 40sec):Didn't get the capability back.Most likely, instruments crashed at startup.
59:06:476 WARNING NewSessionNHandler.safeStart app has crashed at startup :normal
59:06:482 INFO IOSServerManager.findAllMatchingApplications Safari application requested for SDK version: 8.3

Any help from anyone would be appreciated.

2 Answers 2

1

This error shows up when UI automation option is not selected for your device.
Follow the below mentioned steps to enable it:
1.Navigate to your device settings.
2.Open Developers option.
3.Enable the UI automation option.

Now try running your cases.
Hope it helps.

0
  1. First thing to try is to increase newSessionTimeoutSec to 80 or 120 secs.

    I.e. run instead:
    java -jar ios-server-standalone-0.6.6-SNAPSHOT.jar -newSessionTimeoutSec 120 -port 5555


  1. If it doesn't helps below is mdiwakar's solution from a discussion of similar issue on GitHub:

    I am using mac VM, it seems the issue was instruments were crashing and i believe VM were very slow. I did the following

    1) Added Safari Option to have clean session capability
    2) Upgraded to use selenium 2.37 instead of 2.35
    3) Increased the TIMEOUT_SEC to 40 from 20 NewSessionHandler.java(configurable param)
    4) Small change args.add9("-v") to InstrumentsApple.java

    With the above mentioned changes I am able to run my tests with less frequent crashes.

1
  • Thanks for replying. I tried the first approach but was getting the same error. Also, I have seen the mentioned github issue link. But it was not helpful in my case. But when I installed Xcode 6.2 with sdk 8.2 it ran successfully on iPhone 5s simulator. Don't know what the error was while working with the newer version (8.3) of Xcode. Commented Jun 24, 2015 at 21:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.