Home > Blockchain >  Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/Comm
Exception in thread "main" java.lang.NoClassDefFoundError: org/openqa/selenium/remote/Comm

Time:07-13

New to Java here! Trying to automate a sample app and I'm getting the above error. The appium and selenium-java versions are compatible. Tried adding another dependency selenium-remote-driver but the issue still persists.

<dependencies>
    <!-- https://mvnrepository.com/artifact/io.appium/java-client -->
    <dependency>
        <groupId>io.appium</groupId>
        <artifactId>java-client</artifactId>
        <version>7.3.0</version>
     </dependency>
    <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>
  </dependencies>

Can someone please help?

public class base {
    public static void main(String[] args) throws MalformedURLException {
        
        File appDir =new File("src");
        File app =new File(appDir, "ApiDemos-debug.apk"); 
        DesiredCapabilities cap=new DesiredCapabilities();
        cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Pixel 4-Test"); 
        cap.setCapability(MobileCapabilityType.APP, app.getAbsolutePath() ); 
        cap.setCapability(MobileCapabilityType.AUTOMATION_NAME, "uiautomator2");
        AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"), cap); 
}

CodePudding user response:

Try to Invalidate cache and restart if you are using IntelliJ.

CodePudding user response:

Check the path of the Class that you are trying to run.

If you are running via any xml file, check the path of the class there. It might look something like -

<class name="tests.path.for.your.class.file">
  • Related