Skip to content
This repository has been archived by the owner on Jun 27, 2024. It is now read-only.

Extended Robot Framework libraries to make testing Mobile and Windows Desktop easier.

License

Notifications You must be signed in to change notification settings

Accruent/robotframework-applicationlibrary

Repository files navigation

robotframework-applicationlibrary

PyPI version Downloads Build Status Coverage Status CodeFactor

Archive Note

WinAppDriver has been abandonded by Microsoft for some time now, leaving many users in the dark with no real reason to continue its use.

Introduction

Robotframework-ApplicationLibrary is a collection of libraries spanning Mobile and Windows Desktop (WinAppDriver) automation using Robot Framework. These libraries are and extensions of the existing AppiumLibrary. ApplicationLibrary extends the functionality of AppiumLibrary for Mobile app testing and adds support Windows desktop automation.

In the course of our own automation as a team, we found that out-of-the-box AppiumLibrary did not fit our needs for mobile testing and needed major rework inorder to get it working with WinAppDriver for Desktop testing. Originally this code was a part of RobotFramework-Zoomba but diverging dependency requirements lead to a need for two separate repositories.

See the Keyword Documentation for the Mobile or Desktop libraries for more specific information about the functionality.

Example tests can be found in the samples directory.

Some Features of the Library

Extending the AppiumLibrary we added some quality of life 'Wait For And' type keywords:

Wait For And Click Element      locator
Wait For And Click Text         text
Wait Until Element Contains     locator     text

As well as additional features that have yet to be implemented in AppiumLibrary:

Drag and Drop      source_locator     target_locator
Drag And Drop By Offset     locator    x_offset     y_offset
Scroll Down To Text       text
Scroll Up To Text         text

Also extends AppiumLibrary to tailor it Windows desktop automation. This includes enhancements to base keywords such as Open Application or Click Element to perform better for windows. Other notable additions include:

Start and Stop the WinAppDriver as needed (best used for suite setup/teardown):

Driver Setup
Driver Teardown

Easily switching to new windows or the desktop session:

Switch Application      Desktop
Switch Application By Name     remote_url    new_window_name

A variety of keywords for controlling the mouse:

Mouse Over Element     locator
Mouse Over and Click Element    locator
Mouse over and Context Click Element    locator
Mouse Over By Offset     x_offset    y_offset

Keywords for dragging and dropping:

Drag and Drop      source_locator     target_locator
Drag And Drop By Offset     locator    x_offset     y_offset

The ability to send key commands to the application:

Send Keys     \\ue00      p     \\ue00
Send Keys To Element    locator     a     b     c

Selecting an element from a combobox or a menu:

Select Element From ComboBox     combobox_locator      element_locator
Select Elements From Menu     locator_1    locator_2   locator_n
Select Elements From Context Menu     locator_1    locator_2   locator_n

Selecting an element by an image file (Appium v1.18.0 and higher only):

Wait For And Click Element     image=file.png

For WebView2 applications we can control both the application view and the Edge browser view:

rbmzmun3cR

With the split from RobotFramework-Zoomba, the support for this exact example won't work in this current code. An example of this can be found in the samples directory for robotframework-zoomba version 2.14.3 or lower.

Getting Started

The Application library is easily installed using the setup.py file in the home directory. Simply run the following command to install ApplicationLibrary and it's dependencies:

pip install robotframework-applicationlibrary

If you decide to pull the repo locally to make contributions or just want to play around with the code you can install ApplicationLibrary by running the following from the root directory:

pip install .

or if you intend to run unit tests:

pip install .[testing]

To access the keywords in the library simply add the following to your robot file settings (depending on what you are testing):

*** Settings ***
Library    ApplicationLibrary.MobileLibrary
Library    ApplicationLibrary.DesktopLibrary

Additional Setup Information

If you plan to run Mobile automation you will need to have a running appium server. To do so first have Node installed and then run the following:

npm install -g appium
appium

To use the image locator strategy you will need to install opencv4nodejs via the following command:

npm install -g opencv4nodejs

Alternatively Appium Desktop can be used.

For Windows automation we suggest installing and using the WinAppDriver without Appium as it seems to be a bit faster and more stable.

Make sure to enable developer mode on your system to allow the WinAppDriver to work.

Examples

Example tests can be found in the samples directory.

The test directory may also contain tests but be aware that these are used for testing releases and may not be as straight forward to use as the ones in the samples directory.

Contributing

To make contributions please refer to the CONTRIBUTING guidelines.

See the .githooks directory for scripts to help in development.

Support

General Robot Framework questions should be directed to the community forum.

For questions and issues specific to ApplicationLibrary please create an issue here on Github.