When I save and run the code the compiler is showing error with respect to DesiredCapabilities I thought I might have made an error while importing the jar so I uninstalled everything and installed it once again but still the error exists.

This is the code I have written.

package tutorial;

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,"tile-sdk26-debug-2.43.0-d.apk");

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(MobileCapabilityType.DEVICE_NAME, "Nexus 5x");
cap.setCapability(MobileCapabilityType.APP, fs.getAbsolutePath());
AndroidDriver<AndroidElement> driver = new AndroidDriver<AndroidElement>(new URL(""),cap);



This is the error that I am getting.

Error occurred during initialization of boot layer java.lang.module.ResolutionException: Modules java.client and okio export package org.openqa.selenium.internal to module tutorial

1 Answer 1

   DesiredCapabilities capabilities = new DesiredCapabilities();

        capabilities.setCapability("automationName", automationName);
        capabilities.setCapability("deviceName", deviceName);
        capabilities.setCapability("udid", udid);
        capabilities.setCapability("platformName", platformName);
        capabilities.setCapability("platformVersion", platformVersion);
        capabilities.setCapability("systemPort", systemPort);
        capabilities.setCapability("appPackage", "packageName");
        capabilities.setCapability("appActivity", appActivity);
        // capabilities.setCapability("app", appPath);
        Android driver = new AndroidDriver(new AndroidDriver(new URL("" + port + "/wd/hub"), capabilities));

This should work

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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