io.appium.java_client.ios.IOSDriver cannot be cast to org.openqa.selenium.interactions.HasTouchScreen

Environment:
Appium - 1.6.2 version(Desktop)
Java-Client - 6.0.0
iOS - 11.4
Device - Iphone 8 ( Simulator)

Code Snippet:
AppiumDriver driver;
TouchActions action = new TouchActions(driver);
action.longPress(((RemoteWebDriver) driver).findElementByName(“Faded”));
action.longPress(ele).release().perform();
action.perform();
Scenario Description
Long Press on a element / 3D Touch on a particular element and tap a element after the pop-up have displayed

Issue Description:
I have used Remote Web element which have less control over mobile web elemenent. I am struck with this issue for more than a day. Could anyone pls help me on that

2 Likes

Thanks. I tried to resolve it by using Java Script Executor and XCUI Test.

Thanks so much @mykola-mokhnach

Now i am trying to achieve the same in Android Native App. I am trying to automate the scenario, where there is a need to scroll vertically till a particular widget is visible. From there, i need to perform a horizontal scroll in the recycler view of the widget. I am really struck with this issue for more than 2 days.

Environment : Java Client 6, Appium Desktop 1.6

I somehow try to achieve the vertical scroll using UiScrollable and UiSelector Class by finding the element of widget header. But now, my horizontal is not able to scroll horizontal, since it default takes the first recycler view at the top of the screen. I want to scroll the second one. Unfortunately, there is no unique id for the recycler view and textview. Pls, help me out

Vertical Scroll Code Snippet:
driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true).className(“android.widget.LinearLayout”)).scrollIntoView(new UiSelector().resourceId(“com.touchtunes.android:id/home_widget_header”).text(“HOT AT MONTREAL RECEPTION ANGELINA”))”));

Horizontal Scroll Code Snippet:
driver.findElement(MobileBy.AndroidUIAutomator(“new UiScrollable(new UiSelector().scrollable(true).className(“android.support.v7.widget.RecyclerView”)).setAsHorizontalList().scrollIntoView(new UiSelector().resourceId(“com.touchtunes.android:id/item_hot_songs_song”).text(“Hotline Bling”))”)).click();

Thanks, worked for me