appium / appium/java-client

WebElementFacade cannot cast to class io.appium.java_client.android.AndroidDriver

Open
#1,144 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.3k
Forks
752
Avg merge
6d 21h
Merged PRs (30d)
8

Description

Environment:
IDEA: Intellij
Appium Server: 1.13.0
Serenity Verion: 2.0.41
JDK: 1.8

I have initilize my driver by @Manage driver of Serenity BDD like below
@Managed(uniqueSession = true, driver = "appium")
WebDriver appiumDriver;

Then, I wrote a method to inputKeyboard as below
@Deprecated
public void inputNumberFromAndroidKeyboard(WebDriver driver, String number){
AndroidDriver androidDriver = (AndroidDriver) driver;
for(int i = 0; i < number.length(); i++){
switch (number.charAt(i)){
case '0':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_0);
break;
case '1':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_1);
break;
case '2':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_2);
break;
case '3':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_3);
break;
case '4':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_4);
break;
case '5':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_5);
break;
case '6':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_6);
break;
case '7':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_7);
break;
case '8':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_8);
break;
case '9':
androidDriver.pressKeyCode(AndroidKeyCode.KEYCODE_9);
break;
}
}
}

I always run into error. Some one please help me.

[main] ERROR net.thucydides.core.steps.ConsoleLoggingListener - class net.thucydides.core.webdriver.WebDriverFacade cannot be cast to class io.appium.java_client.android.AndroidDriver (net.thucydides.core.webdriver.WebDriverFacade and io.appium.java_client.android.AndroidDriver are in unnamed module of loader 'app')

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the @Managed driver declaration and the inputNumberFromAndroidKeyboard method, especially the cast from WebDriver to AndroidDriver. Reproduce the reported failure with the listed Serenity, Appium Server, and JDK versions, then inspect how the managed driver is represented at that entry point. Done means the cast issue has a documented or verified resolution.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.