I have been trying to scroll down the page in my hybrid mobile application in order to perform action(s) on the elements which are not in focus. Off focus, mobile driver is able to find locators but unable to perform action(s).I tried various solutions across, but it seems to work with android native apps but not in hybrid apps.
var loc = FindElement(locator).Location;
if ((IsDisplayed(locator)))
{
GetActionsObj().MoveTo(loc.X, loc.Y).Wait(10000).Perform();
}
We are getting the exception as "Failed to execute touch event".. We have also tried using
AndroidDriver.Swipe(),Tap()... Nothing worked.
Please help.
In java, i use to swipe like following.
I am not sure if this works on c#.
Just give it a try.
public void swipe(int startX, int endX, int startY, int endY){
try {
new TouchAction(driver).press(PointOption.point(startX, startY)).waitAction(WaitOptions.waitOptions(ofSeconds(1)))
.moveTo(PointOption.point(endX, endY)).release().perform();
} catch (Exception e) {
System.out.println("unable to swipe");
}
}