Skip to content

TouchActions throws java.lang.ClassCastException: io.appium.java_client.android.AndroidDriver cannot be cast to org.openqa.selenium.interactions.HasTouchScreen exception #1092

@dokmetas

Description

@dokmetas

Description

Trying to long press a mobile element by;

        TouchActions action = new TouchActions(driver);
        action.longPress(element);
        action.perform();

per example usage in;
http://appium.io/docs/en/commands/interactions/touch/long-press/

and getting ;

java.lang.ClassCastException: io.appium.java_client.android.AndroidDriver cannot be cast to org.openqa.selenium.interactions.HasTouchScreen
	at org.openqa.selenium.interactions.touch.TouchActions.<init>(TouchActions.java:38)
	at stepdefinitions.Scenarios.i_longpress_contact(Scenarios.java:137)
	at ✽.I longpress contact contact(src\test\resources\features\Contacts.feature:76)

Environment

  • java client build version or git revision if you use some shapshot: 7.0.0
  • Appium server version or git revision if you use some shapshot: appium@1.10.1
  • Desktop OS/version used to run Appium if necessary: Windows 10 Enterprise
  • Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe: npm: '6.5.0'
  • Mobile platform/version under test: Android 7.1.1
  • Real device or emulator/simulator: Real Device Motorola Moto E4 Plus

Other versions

    <aspectj.version>1.8.10</aspectj.version>
    <cucumber.version>4.2.2</cucumber.version>
    <cucumber.jvm.deps.version>1.0.6</cucumber.jvm.deps.version>
    <junit.version>4.12</junit.version>
    <selenium.server.version>3.141.59</selenium.server.version>
    <appium.java.client.version>7.0.0</appium.java.client.version>

Ecxeption stacktraces

https://gist.github.com/dokmetas/a196d76aa648b56543153e8a5659cb2c

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions