Search code examples
appiumrobotframeworktestcaseappium-desktop

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


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


Solution

  • 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