Test automation assists you in maintaining and improving your software without the need for manual testing. It saves you time, prevents human error, and expands your possibilities. What Is Test Automation? Test automation is the practice of using a secondary software...
Ranorex Driver is a service tool based on a Ranorex test suite solution and is used for the automation of desktop applications.
It exposes a W3C WebDriver interface on top of Ranorex runtime. As a result, Ranorex Driver works with tests that are written using Selenium framework.
Ranorex Driver is intended to be used with desktop applications, not all the WebDriver features are implemented.
In this chapter
Installation and Setup
Ranorex Driver is available as a standalone installation C:Program Files (x86)Ranorex.
It was intended to be a lightweight application, it does not install any Ranorex runtime libraries, and integrates with Ranorex Studio on the machine instead (it uses Runtime provided by Ranorex Studio).
The Ranorex Driver version you decide to install must match the version of Ranorex Studio you have installed. For example, if you have Ranorex Studio 10.1.2 installed on your machine, download and install Ranorex Driver version 10.1.2.
Ranorex Driver installation is easy and straightforward, follow these steps to complete it:
Select the location of the Ranorex Studio bin folder, the default port for have Ranorex Driver, and click Next.
After the installation is completed, you can select to run Ranorex Driver automatically by checking the box at the bottom of the window, and click Finish.
If you do not check this option, you need to start the service manually. Find the RanorexDriver.exe in the bin folder of Ranorex Studio as stated above.
Ranorex Driver Status
Once Ranorex Driver launches, you can find its tray icon in the Windows toolbar, right-click the icon to check the current status of Ranorex Driver:
If the status is ‘Connected’ you can start performing your first tests.
Ranorex Driver Configuration
Edit the config.toml file to update the IP address or port. This file is created during Ranorex Service installation and is placed in C:ProgramDataRanorex Driver directory.
When the value for either of them is changed, save the file, and restart Ranorex Service to apply changes.
The API can be invoked after Ranorex Driver is up and ready. The following example shows you how to use Selenium Python client, Ranorex Driver, and the Windows Calculator application to perform your first test.
- Python Installation
Make sure you have Python installed on your machine. If not, download and install it from Python Downloads.
Selenium client is also available in other languages. For example, C# or Java.
- Selenium Installation
After you install Python, open cmd, and install Selenium module using pip tool:
pip install selenium
Automation with Ranorex Driver and Selenium
Create the calc_test.py file in any location and add the content of the following link Ranorex Driver and Selenium Automation.
When you connect to Ranorex Driver there are few parameters to set, review the following:
- browserName – This should always be “Ranorex”
- rx:app – Path of an application to start with the session and its arguments e.g. “test.exe”
- rx:args – Arguments for the application to start
- rx:force – Forces the current session to be aborted an restarted
- rx:whitelist – List of additional process names to whitelist for the session
Save the file and open cmd tool. Navigate to the location where you saved calc_test.py and invoke command:
The Calculator application should have started and the automation should run.
Supported WebDriver APICommands
- New Session
- Delete Session
- Set Timeouts
- Get Title
- Find Element
- Get Element Attribute
- Get Element Text
- Get Element Tag Name
- Is Element Enabled
- Element Clear
- Take Element Screenshot
Visit WebDriver for more information about the above API. Note that API on the website is described in context of plain REST API requests but these equivalents methods can be found in the Selenium Python module as well.