Can't get touch actions to work : AndroidDriver cannot be cast to....selenium.interactions.HasTouchScreen

Hi, I am trying to get my AndroidDriver to scroll.

I am trying this:

WebElement secret = driver.findElement(“”));
TouchActions action = new TouchActions(driver);
action.scroll(secret, 10, 100);

But I get this:
java.lang.ClassCastException: cannot be cast to org.openqa.selenium.interactions.HasTouchScreen

I have imported: import org.openqa.selenium.interactions.touch.TouchActions; as that was the only class available to import. Should I be using an Appium on einstead?

use Appium TouchAction instead of Selenium TouchActions

Thanks mashKrum. I’ve got it to work using the following code to scroll by moving from one element location to another…thanks again :slight_smile:

    WebElement resource = driver.findElement(""));
    WebElement openid = driver.findElement(""));
    TouchAction action = new TouchAction(driver);;
1 Like