Hi everyone, I’m trying to test the appium v8.0.0 but cannot initialize the driver correctly.
Env:
Java 11
appium server: 1.21.0
appium client: 8.0.0
my pom:
4.0.0
<groupId>org.example</groupId>
<artifactId>mobile-test-example</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<appium.version>8.0.0</appium.version>
<testng.version>7.4.0</testng.version>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>${appium.version}</version>
</dependency>
</dependencies>
My test code:
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(“platformName”, Platform.ANDROID);
capabilities.setCapability(“deviceName”, “emulator-5556”);
capabilities.setCapability(“automationName”, “UIAutomator2”);
capabilities.setCapability(“app”, “/Users/test/Projects/mobile-test-example/build/wordpress.apk”);
capabilities.setCapability(“appPackage”, “org.wordpress.android”);
capabilities.setCapability(“appActivity”, “org.wordpress.android.ui.WPLaunchActivity”);
final String URL_STRING = "http://127.0.0.1:4723/";
URL url = new URL(URL_STRING);
AndroidDriver driver = new AndroidDriver(url, capabilities);
driver.findElement(By.id("org.wordpress.android:id/nux_username")).sendKeys("[email protected]");
The error return as:
java.lang.ClassCastException: class org.openqa.selenium.Platform$22 cannot be cast to class java.lang.String (org.openqa.selenium.Platform$22 is in unnamed module of loader ‘app’; java.lang.String is in module java.base of loader ‘bootstrap’)
I tried both AppiumDriver and AndroidDriver type but neither worked to me.