Search code examples
androidappiumrobotframework

Using UI Automator as the locator when using Appium and RobotFramework


I am trying to use UI Automator as the locator for clicking some elements. For reference I'm using RobotFramework and the robotframework-appiumlibrary.

The snippet I'm trying to use is:

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

From the documentation that looks like it should work.

However this fails every time with the following output:

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.

I'm largely confused because I'm distinctly not trying to call the WebDriver and I don't know why I'm getting that instead of the UI Automator.


Solution

  • So turns out the documentation was wrong as is described here: https://github.com/jollychang/robotframework-appiumlibrary/issues/96

    The following is what the documentation says should work:

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

    And this is what actually works:

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

    I made the relevant edits and created a pull request hopefully nobody else gets stuck in the trap I did.