Skip to content

java.lang.ClassCastException: org.openqa.selenium.remote.RemoteWebElement cannot be cast to io.appium.java_client.MobileElement #774

@aeroclee

Description

@aeroclee

Issue Description along with Code:

protected WindowsDriver driver;

java.lang.ClassCastException Issue if directly access the method like below:
System.out.print("Title Check: "+driver.findElementByAccessibilityId("Title).getText());

WorkAround: No java.lang.ClassCastException Issue if cast to the WebElement like below.
WebElement title = driver.findElementByAccessibilityId("Title");
getPrintHelper().print("Check the App Title: "+title.getText());

Environment:
Maven POM File:
<appium.version>5.0.4</appium.version>
<selenium.version>3.6.0</selenium.version>
<testng.version>6.11</testng.version>

io.appium java-client ${appium.version} org.seleniumhq.selenium selenium-java ${selenium.version} org.testng testng ${testng.version}

Appium server version or git revision: WinAppDriver V1.0 release (File Version 1.0.1710.17001)

Desktop OS/version used to run Appium if necessary: Windows 10
Mobile platform/version under test: Windows 10 App

Note: Looks like same/similar issue as following:
microsoft/WinAppDriver#286

Exception stacktraces:
https://gist.github.com/aeroclee/b1d3bba03c3188d575b251b557c13cec

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions