如何使用硒获取android

如何使用硒获取android

本文介绍了如何使用硒获取android native app的x,y坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Selenium Java Web驱动程序获取android native应用的x,y坐标.

How to get x,y coordinates of android native app using selenium java web driver.

我正在使用鸦片.我的应用程序打开了android图像库.由于uiautomatorviewer没有显示其布局.我无法点击图片.

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.

诸如moveToElement,mouseMoveAt等仅适用于浏览器.本机应用程序有哪些可用选项.

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);

这篇关于如何使用硒获取android native app的x,y坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 10:38