I’m automating on a Android Real Device, For an element, the getLocation() API returns the x &y co-ordinates of an element, but when i try to perform actions like tap, swipe, with the co-ordinates which is been fetched from getLocation() API the action does not seem to be performed on expected element.
The co-ordinates fetched through getLocation() API differs from the co-ordinates shown by the Android Devices Pointer Location.
How should tap,swipe be performed based on the elements co-ordinates using TouchActions API.
Hi
Thanks for your reply.
I did try getting the element size, based on the height and width get the centre position of the element and perform a tap but observed that on android tab screen resolution is different.
should I set any capabilities for screen resolution based on the device type.
Try use Values of X and Y values returned by getLocation()
for example int leftX = element.getLocation().getX(); int rightX = leftX + element.getSize().getWidth(); int middleX = (rightX + leftX) / 2; int upperY = element.getLocation().getY(); int lowerY = upperY + element.getSize().getHeight(); int middleY = (upperY + lowerY) / 2;