1

I am getting this error "The type org.openqa.selenium.remote.DesiredCapabilities cannot be resolved. It is indirectly referenced from required .class files"

when I compile and run the program.

when I hover the mouse near the error location in the code this is the information its displaying.

""The type org.openqa.selenium.remote.DesiredCapabilities cannot be resolved. It is indirectly referenced from required .class files

package manoj_test;

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.AndroidElemen0t;
import io.appium.java_client.remote.MobileCapabilityType;

public class tes12 {

public static void main(String[] args) throws MalformedURLException {
// TODO Auto-generated method stub
DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "0260dd0730971a0a");
cap.setCapability(MobileCapabilityType.APP, "/home/manoj/Downloads/xyz.apk");
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL("http://127.0.0.1:4723/wd/hub"),cap);



}

}
  • In my case I resolved it changing JVM, I had 11, and then changed it for 8. – liusyliu Jul 23 at 19:24
1

Hope you are using Pom.xml to add dependencies.if that is the case check you have added bellow dependencies apart from appium dependencies.

<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-remote-driver</artifactId>
    <version>2.44.0</version>
</dependency>

if you still have same problem import bellow dependencies to your code.

import org.openqa.selenium.remote.CapabilityType;  
import org.openqa.selenium.remote.DesiredCapabilities;

finally, you can add java client directly to your build path.

Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.