touchAction.moveToElement(WebElement) does not work
I need to moveTo a dynamically generated element on Win10 using JAVA.
Code: TouchActions touchAction = new TouchActions(SettingSession); touchAction.moveToElement(SettingSession.findElement(By.xpath("//ListItem[contains(@Name,'"+ptr_name+"')]")));
Getting this error:
java.lang.ClassCastException: io.appium.java_client.windows.WindowsDriver cannot be cast to org.openqa.selenium.interactions.HasTouchScreen
at org.openqa.selenium.interactions.touch.TouchActions.
This Appium API did the job for Windows Settings
Actions action = new Actions(SettingSession); action.moveToElement(SettingSession.findElement(By.xpath("//ListItem[contains(@Name,'"+ptr_name+"')]")));
action.perform();
Closing this issue
Hi @AmitVerma4HP ,
I am facing a similar issue now. I have tried the same code you have attached. However, I could not see it moving to the element but the test has passed.
Also, can you let me know how did you find xpath like this from appium inspector ?
Help is much appreciated.
Thanks Viji