How to get x, y coordinates of native android app using selenium
How to get x, y coordinates of native android application using selenium java web driver.
I am using appium. My app opens the Android image gallery. As uiautomatorviewer doesn't render layout for it. I was unable to click the image.
It looks like moveToElement, mouseMoveAt, etc. only works for browsers. What are the options available for the native application.
+3
source to share
2 answers
I found a solution using the code below. When pressed in a certain position, I could select an image.
HashMap<String, Integer> tapObject = new HashMap<String, Integer>();
tapObject.put("x", 100); // in pixels from left
tapObject.put("y", 300); // in pixels from top
driver.executeScript("mobile: tap", tapObject);
+1
source to share