Trying to run a Robot Framework Test Case against a Windows app with Appium Server - possible?

Viewed 1002

I am using Robot Framework with the RIDE IDE. I have an Appium Server session running. As a first try, I want to write a Robot Framework test case to open an instance of the Windows notepad. Firstly, is this even possible, or am I misguided?

Appium

The following are the settings used:

Remote Host: 127.0.0.1

Remote Port: 4723

Remote Path: /

SSL: disabled

The "Desired Capabilities" are set as represented by the following JSON:

{
    "app": "C:\\Windows\\system32\\notepad.exe"
}

WinAppDriver

It is running on port 4723.

RIDE IDE

The following test case is being executed:

*** Settings ***
Library           AppiumLibrary

*** Test Cases ***
TC0
    Open Application    http://localhost:4723/wd/hub    app=C:\Windows\System32\notepad.exe

This yields the following error:

[ WARN ] Keyword 'Capture Page Screenshot' could not be run on failure: No application is open

What might be the cause of this?

Edit: Additional information - when executing the above test case, the following appears in the WinAppDriver console: enter image description here

2 Answers

Per default AppiumLibrary will run Capture Page Screenshot on failure.
AppiumLibrary Documentation

Most likely sequence is as follow.

  1. Test case try open notepad but fail.
    Open Application http://localhost:4723/wd/hub app=C:\Windows\System32\notepad.exe

  2. On this failure AppiumLibrary try Capture Page Screenshot but fails due to there is no open application since step 1 failed.

I believe you need to focus on troubleshooting why the app do not open properly.

If you like to suppress this failure you can you can set AppiumLibrary to not capture screen on failure in the import with run_on_failure=No Operation, see the linked documentation above.

Library AppiumLibrary run_on_failure=No Operation

Slightly unrelated but I just wanted to give a few tips with using winappdriver and robotframework as there isn't a lot of concise information out there.

  1. I personally have found that running the winappdriver through appium has been slower than running the winappdriver standalone.
  2. localhost is also slower than using 127.0.0.1 as your system has to resolve that address each time: https://github.com/microsoft/WinAppDriver/issues/1269
  3. AppiumLibrary is still very tailored to Mobile automation so it is missing some of the usual things you would want in desktop automation such as 'drag and drop', 'mouse over element', keywords for controlling the driver setup/teardown, etc. RobotFramework-Zoomba's DesktopLibrary extends AppiumLibrary and adds a lot of these keywords if you would be willing to try that out. Keyword docs can be found here: https://accruent.github.io/robotframework-zoomba/DesktopLibraryDocumentation.html
Related