使用 Appium 和 RobotFramework 时使用 UI Automator 作为定位器

Using UI Automator as the locator when using Appium and RobotFramework

我正在尝试使用 UI Automator 作为点击某些元素的定位器。作为参考,我使用 RobotFrameworkrobotframework-appiumlibrary.

我尝试使用的片段是:

Click Element  android=new UiSelector().description('arbitraryDescription')

来自 the documentation 看起来应该可以。

但是每次都失败并输出以下内容:

WebDriverException: Message: The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource.

我很困惑,因为我显然没有尝试调用 WebDriver,而且我不知道为什么我得到的是它而不是 UI Automator。

原来文档是错误的,如下所述:https://github.com/jollychang/robotframework-appiumlibrary/issues/96

以下是文档所说的应该起作用的内容:

Click Element android=new UiSelector().description('arbitraryDescription')

这才是真正有效的方法:

Click Element android=UiSelector().description('arbitraryDescription')

我进行了相关编辑并创建了一个拉取请求,希望没有其他人陷入我所做的陷阱。