Problem

The following error is received when executing a script:

It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long was not found or it is not accessible

Solution

Following are possible solutions to this problem. However, the error message is very generic. It could also be caused by other reasons not covered here, for example by the device being offline.


The issue occurs when app and bundleId capabilities are used together. Due to changes in Appium, you cannot use the following two capabilities together:

capabilities.setCapability("bundleID", "YourApp");

capabilities.setCapability("browserName", "YourMobileBrowserChoice);

Per Appium's own GitHub information page, this is by design. You must use one or the other, independently. Use the bundleID capability if testing only with an app. Use browserName if testing only with mobile browsers. Alternatively, you can set the bundle ID as a string variable instead of calling it as a capability. You can also do the same with the browser name. For example:

String myWUT = "https://testsite.who";
String myAUT = "com.company.myapp";



The issue occurs when there is no trusted app on the device and the bundleID capability used. Upon installing an application, the old version of the application is uninstalled, and if no other application is signed by the same developer, the iOS Trusted settings will be reset. The newly installed application will not be Trusted. When you connect to a device with the capability of an app, with the intent to start the app, you may receive this error because of the lack of trust.

The solution is to check the app on the device and make sure that it is trusted. Then run your automation.


The issue occurs when a connection is attempted to reach the cloud but is blocked by your local proxy or firewall rules.

In this case, do the following:

  1. Check if you can connect to your mobile cloud and open a device, from your desktop web browser of choice. If it passes, the issue is most likely the security of your company and the IDE being used (such as Eclipse, IntelliJ, UFT, or xFramium).
  2. To troubleshoot this issue, put your IDE into debug mode. Then step through each step in debug mode, which should give you the details of the API command that is failing.

    Most reasons for this issue are an incorrect URL to the cloud (for example trying to use <yourLab>.perfecto.com instead of <yourLab>.perfectomobile.com). Check your constructor and ensure that the host variable is set properly. For example:

    String host = mycloud.perfectomobile.com;
    AppiumDriver driver = new AppiumDriver(new URL("https://" + host + "/nexperience/perfectomobile/wd/hub"), capabilities);


Related articles

Related articles appear here based on the labels you select. Click to edit the macro and add or change labels.

Application fails to launch due to trust issue | Troubleshooting

Trust an iOS application developer

Related issues