dimanche 4 novembre 2018

Not able to launch the app on a android device

Getting error as below while launching the app:

Exception in thread "main" 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.

Here is my code:

import java.io.File;

import java.net.MalformedURLException;

import java.net.URL;

import org.openqa.selenium.By;

import org.openqa.selenium.remote.DesiredCapabilities;

import io.appium.java_client.android.AndroidDriver;

import io.appium.java_client.android.AndroidElement;

import io.appium.java_client.remote.MobileCapabilityType;



public class Login {



  public static void main(String[] args) throws MalformedURLException {

    // TODO Auto-generated method stub

     File file = new File("src");

     File appName = new File(file, "example.apk");

     DesiredCapabilities capabilities = new DesiredCapabilities();

     capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "demo");

     capabilities.setCapability(MobileCapabilityType.APP, appName.getAbsolutePath());

     AndroidDriver<AndroidElement> driver = new AndroidDriver<>(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);

 }
 }

I tried following things:- 1.To install the app manually first then launch the app.

2.To launch the app without installing.

3.Tried with other version of .apk.

But I am getting the same error,please help me to know why getting this error.

Aucun commentaire:

Enregistrer un commentaire