lundi 9 novembre 2020

Error: Unable to initialize main class base Caused by: java.lang.NoClassDefFoundError: org/openqa/selenium/Capabilities

I have looked through all the solutions, but all of them are vague. They just tell to add jar files, but don't specify which ones and from where. The links provided are also very vague. Besides this, another solution was to add jar files to classpath, not module path, but I am unable to find where either of them are located in the configure path option. Following is my code:

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 base {

    public static void main(String[] args) throws MalformedURLException { 
        // TODO Auto-generated method stub
        File f=new File("src");
        File fs=new File(f, "app-debug.apk");
    
        DesiredCapabilities cap=new DesiredCapabilities();
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus_5X_API_30_2");
        cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
        cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
        AndroidDriver<AndroidElement> driver=new AndroidDriver<>(new 
        URL("http://127.0.0.1:4723/wd/hub"),cap);

    }

}

Aucun commentaire:

Enregistrer un commentaire