【问题标题】:How to click by Image in Mobile App by appium如何通过appium在移动应用中点击图片
【发布时间】:2020-01-02 11:22:51
【问题描述】:

我需要点击在 Google 或 Appium 移动应用自动化中的 EIS 搜索地图模块中搜索后显示的红色标记位置图钉。

PFB 我正在使用的当前解决方法的详细信息,但这种行为并不一致,并且相对于执行时间而言非常耗时。任何人都可以帮忙。请注意,此 Pin 标记的位置无法通过 UI Automate Viewer 识别。

PFA 应用程序中的图像截图。

【问题讨论】:

    标签: android selenium-webdriver automated-tests appium android-uiautomator


    【解决方案1】:

    您可以使用OpenCV 进行图像识别,例如:

    1. Take screenshot 您正在测试的应用程序
    2. 使用即Template Matching算法在图像上定位“红色标记”并获取其坐标
    3. 使用TouchActions.press()函数在步骤2中的坐标处执行点击

    或者,您可以选择提供 Image Recognition capabilities 的 SeeTest Appium 扩展

    【讨论】:

      【解决方案2】:

      首先定义位置(x,y 坐标)。 => Element.getLocation()

      使用driver.tap()Actions.press()longPress()方法之后。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-12-05
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-26
        相关资源
        最近更新 更多