Unable to scroll using coordinates in iOS Simulator in UIACatalog app

I am unable to scroll using coordinates in iOS Simulator in UIACatalog app
I tried different ways but it didn’t scroll If i use coordinates If I use webelement directly it scrolls

// This doesnt work
startx = driver.findElementByAccessibilityID(“Alert Controller”).getLocation.getX();
starty = driver.findElementByAccessibilityID(“Alert Controller”).getLocation.getY();
endx = driver.findElementByAccessibilityID(“Sliders”).getLocation.getX();
endy = driver.findElementByAccessibilityID(“Sliders”).getLocation.getY();
driver.swipe(startx,starty,endx,endy)

// This works
TouchAction act = new TouchAction(driver);
WebElement To_elem = driver.findElementByAccessibilityID(“Alert Controller”);
WebElement from_elem = driver.findElementByAccessibilityID(“Sliders”);
act.press(from_elem ).moveTo(To_elem).release().perform();

In above web elements are same in both code but coordinates code does not work ? It simply taps
I want to know the reason please help me with this ??

1 Like