【问题标题】:UIAutomatorViewer unable to detect page elementsUIAutomatorViewer 无法检测页面元素
【发布时间】:2018-02-04 18:17:34
【问题描述】:

我正在尝试使用 Selenium Appium 自动化 eBay 移动本机应用程序。我能够检索所有页面的页面元素,但是对于登录页面我不是。我在 UIAutomator 和 Appium Inspector 1.6.5 中都收到错误消息,一直在搜索而没有响应。我想知道问题是否与 eBay 页面有关,或者是否有任何其他替代方法可以找到定位器。 重现步骤: 1.在ebay中搜索任何对象->进入详细信息页面->点击观看

CaptureImage Issue

【问题讨论】:

    标签: selenium xpath appium android-uiautomator


    【解决方案1】:

    如果您的 appium 服务器在移动设备或模拟器中的或 APP 上,则会出现此问题,现在再次打开应用程序并导航到您想要的屏幕。这次试试

    停止您的服务器并关闭此 uiautomatorviwer 并再次打开 uiautomatorviwer。这次您不会收到错误消息。

    另一种定位元素的方法是:-

    使用下面的代码:-

    System.out.println("source : "+ driver.getPageSource());
    

    driver.getPageSource() 将返回屏幕的 XML。 现在你可以在你的元素上构建一个 xpath。

    使用下面的链接来美化你的 xml

    http://xmlbeautifier.com/

    使用下面的代码来验证你的 xpath

    https://www.freeformatter.com/xpath-tester.html

    希望对你有帮助:)

    【讨论】:

      猜你喜欢
      • 2016-05-01
      • 1970-01-01
      • 2021-08-21
      • 1970-01-01
      • 1970-01-01
      • 2020-01-31
      • 1970-01-01
      • 1970-01-01
      • 2019-05-10
      相关资源
      最近更新 更多