Skip to content

Unable to init Appium driver Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys #1695

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
luckhiem opened this issue May 29, 2022 · 2 comments

Comments

@luckhiem
Copy link

Description

Unable to init Appium driver Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys.

Environment

  • Java client build version or git revision if you use some snapshot: java 11
  • Appium server version or git revision if you use some snapshot: 1.22.3
  • Desktop OS/version used to run Appium if necessary: com.apple.MobileAddressBook
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: v16.14.2
  • Mobile platform/version under test: IOS
  • Real device or emulator/simulator: IOS Simulator

Details

Unable to init Appium driver Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys.

Code To Reproduce Issue [ Good To Have ]

package core.driver.manager;

import core.driver.IDriver;
import core.server.ServerManager;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.options.XCUITestOptions;
import io.appium.java_client.remote.AutomationName;

import java.net.MalformedURLException;
import java.net.URL;

public class IOSDriverManager implements IDriver {
    @Override
    public AppiumDriver createDriver(String deviceName, String wda) throws MalformedURLException {
        return new IOSDriver(new URL(ServerManager.getAppiumServerAddress()), createCapabilities(deviceName, wda));
    }

    @Override
    public XCUITestOptions createCapabilities(String deviceName, String wda) {
        XCUITestOptions cap = new XCUITestOptions()
                .setDeviceName(deviceName)
                .setAutomationName(AutomationName.IOS_XCUI_TEST)
                .setFullReset(true)
                .setWdaLocalPort(Integer.parseInt(wda))
                .setApp("com.apple.MobileAddressBook")
                .setPlatformVersion("15.0");
        return cap;
    }
}

pom.xml

<dependencies>
        <dependency>
            <groupId>io.appium</groupId>
            <artifactId>java-client</artifactId>
            <version>8.0.0</version>
        </dependency>

        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.5</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.2.0</version>
        </dependency>

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

        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.22.0</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.17.2</version>
        </dependency>

        <dependency>
            <groupId>org.aeonbits.owner</groupId>
            <artifactId>owner</artifactId>
            <version>1.0.12</version>
        </dependency>
    </dependencies>

Exception Stacktraces

java.lang.NoClassDefFoundError: org/openqa/selenium/remote/AcceptedW3CCapabilityKeys
Caused by: java.lang.ClassNotFoundException: org.openqa.selenium.remote.AcceptedW3CCapabilityKeys
@mykola-mokhnach
Copy link
Contributor

This error is expected as Selenium got some breaking changes in v4.2.0
#1696 should add the necessary compatibility fixes

@valfirst
Copy link
Collaborator

Fixed and released: io.appium:java-client:8.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants