【问题标题】:How to get x,y coordinates of android native app using selenium如何使用 selenium 获取 android 本机应用程序的 x,y 坐标
【发布时间】:2014-10-21 17:35:15
【问题描述】:

如何使用 selenium java web 驱动程序获取 android 本机应用程序的 x,y 坐标。

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

看起来 moveToElement、mouseMoveAt 等仅适用于浏览器。本机应用程序有哪些可用选项。

【问题讨论】:

    标签: java selenium selenium-webdriver appium


    【解决方案1】:

    我通过使用以下代码找到了解决方案。通过点击某个位置,我可以选择图像。

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

    【讨论】:

      【解决方案2】:

      考虑切换到 Appium。 Appium 在 Selenium 之上添加了一个额外的层,可以帮助您自动化原生 iOS 和 Android 应用程序。

      http://appium.io

      【讨论】:

      • 我编辑了我的问题。你可以再详细一点吗。我需要使用什么样的类
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-19
      相关资源
      最近更新 更多