I am trying to run my test in an android mobile in a cloud platform cloud.seetest.io by installing appium studio plugin in eclipse so that test can be run directly from eclipse IDE itself.

It is always giving the error as

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

@BeforeMethod
    @Parameters("deviceQuery")
    public void setUp(@Optional("@os='android'") String deviceQuery)throws Exception{

    init(deviceQuery);
        // Init application / device capabilities
    dc.setCapability(MobileCapabilityType.APP, "cloud:xxxxxxxx/.xxxx");
    dc.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "xxxxx");
    dc.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, ".xxxxxx");
    dc.setCapability(SeeTestCapabilityType.DEVICE_QUERY, deviceQuery);
    dc.setCapability(SeeTestCapabilityType.TEST_NAME, "AndroidDemoTest");
    dc.setCapability("appVersion", "1.0.10516");
    dc.setCapability("testName", "AndroidDemoTest");
    driver = new AndroidDriver<>(new URL(getProperty("url",cloudProperties) + "/wd/hub"), dc);

    }
4

There are 4 best solutions below

0
On BEST ANSWER

This problem occurs when the driver is unable to get initiated. While connecting to experitest, these could have been the problems which give this error:

  1. Licence of Experitest. If the licence is for one device/session at a time, one cannot attempt to create another session.

  2. Desired Capabilities. Make sure that the device with the device id you mentioned in the code is available in the seetest cloud. Best practice is to first block the device and then copy the UDID to code.

In fact, there can be many reasons which could lead to no driver getting created. The actual reason behind this error is mentioned down there itself in the stack trace. Go down the stack trace and you will find the actual reason.

In my case it was the second one that happened.

0
On

Most probably your Appium client library version is not supported, as per Set Appium Java Client chapter:

You could make use of the Appium Java Client by adding a dependency to your Maven and Gradle projects

Please make sure you replace with the appropriate version:

  • 4.1.2
  • 5.0.4
  • 6.1.0
  • 7.0.0

It is recommended to use the public maven repo before the code export.

So inspect your dependency management file and make sure to update the io.appium.java-client dependency to one of the supported versions.

0
On

Experitest's client libraries might be missing. Try adding compile 'com.experitest:repo:+' in your build.gradle. This would download the latest client libraries. This document might help you in creating a sample project with Appium Studio plugin

0
On

Solution 1st

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("deviceName", "xyz");
capabilities.setCapability("platformVersion", "6.0");
capabilities.setCapability("platformName", Platform.ANDROID);
capabilities.setCapability("appPackage", "com.hp.HPSupportAssistant");
capabilities.setCapability("appActivity", "com.hp.HPSupportAssistant.MainActivity");
 capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 6000);    capabilities.setCapability(AndroidMobileCapabilityType.AUTO_GRANT_PERMISSIONS,true);
//desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);

Here comment below line and then run it will work desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);

solution 2nd Or keep above line in desired capabilities but before that do run 3 cmd on cmd promt

adb shell pm list packages -f > D://t.txt
adb uninstall io.appium.uiautomator2.server
adb uninstall io.appium.uiautomator2.server.test

desiredCap.setCapability(MobileCapabilityType.AUTOMATION_NAME,AutomationName.ANDROID_UIAUTOMATOR2);