Ranorex Driver| Ranorex Help Center
Help CenterUser GuideRanorex Driver

Ranorex Driver

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.

Note icon

Note

Ranorex Driver is intended to be used with desktop applications, not all the WebDriver features are implemented.

This means that functionalities like alert handling, Javascript execution, and cookie related functionalities are not available. Review the list of the supported methods.

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).

    Note icon

    Note

    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.

    Click Install.

    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:\ProgramData\Ranorex Driver directory.

     When the value for either of them is changed, save the file, and restart Ranorex Service to apply changes.

    from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Remote("http://127.0.0.1:7993", { "browserName": "Ranorex", "rx:app": "Calc", "rx:args": "", "rx:force": True, "rx:whitelist": ["Calculator", "Calc"]}) print("Calc application opened: " + driver.title) button2 = driver.find_element_by_xpath("/winapp//button[@automationid='num2Button']") print("Calc button 2 get handle") button2.click() print("Calc button 2 clicked") driver.find_element_by_xpath("/winapp//button[@automationid='num1Button']").click() print("Calc button 1 clicked") driver.find_element_by_xpath("/winapp//button[@automationid='multiplyButton']").click() print("Calc button * clicked") driver.find_element_by_xpath("/winapp//button[@automationid='num2Button']").click() print("Calc button 2 clicked") driver.find_element_by_xpath("/form").send_keys("=") print("Calc sent key =") result = driver.find_element_by_xpath("/winapp//text[@automationid='NormalOutput']").text print("result: " + result) driver.close()

    Example

    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.
    Note icon

    Note

    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.

    Note icon

    Note

    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:
            python  test_calc.py

    The Calculator application should have started and the automation should run.

    Supported WebDriver APICommands

    As mentioned previously, Ranorex Driver does not support all Webdriver API. Below, the list of the supported functionalities:
      • New Session
      • Delete Session
      • Status
      • 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.