How to get x,y coordinates of android native app using selenium java web driver.
I am using appium. My app opens the android image gallery. As the uiautomatorviewer doesn't show the layout for it. I couldn't able to click an image.
Looks like moveToElement, mouseMoveAt etc is working only for browsers. What are the options available for native app.
I found a solution by using the below code. By tapping in a certain position I could able to pick 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);
Consider switching to Appium. Appium ads an extra layer on top of Selenium which can help you to automate native iOS and Android applications.
http://appium.io