samedi 3 novembre 2018

Getting error as : java.lang.ClassNotFoundException: org.openqa.selenium.remote.ProtocolHandshake

I am running my first Appium automation script and I am getting error as :

  > Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/ProtocolHandshake
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:93)
at io.appium.java_client.android.AndroidDriver.<init>(AndroidDriver.java:93)
at com.practise.pages.Login.main(Login.java:21)
Caused by: java.lang.ClassNotFoundException: 
org.openqa.selenium.remote.ProtocolHandshake
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 3 more

Here is my code:

     package com.practise.pages;

     import java.io.File;
     import java.net.MalformedURLException;
     import java.net.URL;
     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,"ApiDemos-debug.apk");
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "demo");
        capabilities.setCapability(MobileCapabilityType.APP, appName);

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



}

}

Please help me to know why I am getting error.

Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/ProtocolHandshake

Aucun commentaire:

Enregistrer un commentaire