Get started with Window app automation with Robot framework & Appium

Hello All,

Yes you all read it correct. When I have started automating window application , I was wondering few weeks back can I do it using robot framework.

I did with Java and Appium to automate the window app. But having good working knowledge of robot framework I was excited to automate certain things with Robot framework.

Below is the boiler plate code to launch desktop exe which your AUT - Application Under Test with robot framework.

I hope all the prerequisites are already installed to the system.

Prerequisite:

  • Latest RF
  • Latest appium library
  • Appium 

  1. Launch the WinAppDriver.exe under C:\Program Files (x86)\Windows Application Driver
  2. Set up the desired capabilities in test setup of RF script
    1. Code snippet 
  3. AppiumLibrary.Open Application    ${REMOTE_URL}    platformName=Windows    deviceName=DEVICENAME    app=${location}    automationName=appium

Always get the device name properly otherwise script will fail. In order to get the device name goto command prompt for Windows PC , add hostname >> that will give you correct device name, place it in above parameter.

And complete script seems below.

*** Settings ***
Library    OperatingSystem    
Library    SeleniumLibrary    
Library    AppiumLibrary   

Test Setup    AppiumLibrary.Open Application    ${REMOTE_URL}    platformName=Windows    deviceName=DEVICENAME    app=${location}    automationName=appium
# Test Teardown    AppiumLibrary.Close Application


*** Variables ***
${username}    root
${password}    root
${location}    C:/Test/AUTTEST.exe [Replace with your exe path]

${USER_ID}    accessibility_id=tbUser  
${USER_PASS}    accessibility_id=tbPassword 
${LOGIN_BTN}    name=OK 
${REMOTE_URL}    http://127.0.0.1:4723

*** Keywords ***

*** Test Cases ***

Login To APP
    AppiumLibrary.Input Text    ${USER_ID}    ${username}
    BuiltIn.Sleep    2s    
    AppiumLibrary.Input Text    ${USER_PASS}    ${password}
    BuiltIn.Sleep    2s    
    AppiumLibrary.Click Button    ${LOGIN_BTN}
    BuiltIn.Sleep    10s        
    BuiltIn.Log To Console    Clicked
    
Test Case
    BuiltIn.Log To Console    test    

This will give launch the exe file and login.

Replace the locators as per your application.

Hope it will be helpful to community.

Feel free to share your thoughts/views.

Cheers.

Comments

Popular Posts