Search code examples
appiumappium-androidseetestexperitest

"It is impossible to create a new session because 'createSession' which takes HttpClient, InputStream and long" while running test in experitest


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);

    }

Solution

  • 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.