Selenium Connector

Usage

The Selenium connector connects the Selenium test framework with the test environment of the INUBIT software.

The connector’s function is to trigger from within Technical Workflows automated test cases and test suites of web applications created with a selenium framework.

It can be used to test e.g. portal functions of the INUBIT Process Cockpit.

User-specific extensions enabling the definition and storage of specific test commands in the user-extensions.js are not supported.

The Selenium connector is compatible with the Selenium server versions 1.x only. Selenium server version 2 is not supported.

Connector types

A Selenium connector can be used as a medium or an output connector:

  • Medium Connector
    Sends XML-based test data to the Selenium Remote Control Server and receives log data from the Selenium server, which are forwarded to the subsequent module in the workflow.

  • Output Connector
    Sends XML-based test data to the Selenium Remote Control Server and receives log data from the Selenium server, which are passed on to a target application.

Requirements

  • The complete Selenium test framework must be installed.

  • A Selenium Remote Control server must be installed.

  • A Web browser must be installed.

For further information about Selenium refer to the following links:

Principles

The Selenium connector connects to the Selenium Remote Control server to control a Web browser installed on a local or remote host.

The server starts, stops the browser and acts as the HTTP proxy for the browser.

module guide 1160 0

Input message

The Selenium connector requires an XML input message that can look like the example below:

<?xml version="1.0" encoding="UTF-8"?>
<script>
  <base-url>https://www.google.de</base-url>
  <suite>
    <command>
      <action>setSpeed</action>
      <target>500</target>
      <value />
    </command>
    <command>
      <action>open</action>
      <target>/</target>
      <value />
    </command>
    <command>
      <action>type</action>
      <target>q</target>
      <value>inubit</value>
    </command>
    <command>
      <action>clickAndWait</action>
      <target>btnG</target>
      <value />
    </command>
  </suite>
</script>

In the input message, you must define the base-url of the test application: this URL must be specified in order to indicate that all test commands apply to relative paths meaning that test cases can be run across different domains.

To ensure a correct performance, both domains specified in the base-url element and in the open-Element must be the same.

Refer to Error Handling.

You can find templates for input and output messages in the Repository at Global > System > Mapping Templates > Selenium Connector.

Processing

The Selenium connector passes the input message to the Selenium server which executes the test commands and returns a compilation of test results to the connector. These log data are contained in the output message of the Selenium connector

Output message

Below you find an example for an XML output message:

<result>
  <suite>
    <command display="setSpeed(500)"
      duration="31">OK
    </command>
    <command display="open(/)"
      duration="813">OK
    </command>
    <command display="type(q)"
      duration="500">OK
    </command>
    <command display="clickAndWait(btnG)"
      duration="1062">OK
    </command>
  </suite>
  <lastlogs>
    <lastlog>
      <![CDATA[13:24:42.413 INFO [10]
      org.mortbay.util.Container - Starts ...]]>
    </lastlog>
    [...]
  </lastlogs>
</result>

Error Handling

Error Cause Solution

You appear to be changing domains from http://XXX to http://ZZZ

If no base-url is specified, the INUBIT software uses a preselection of the RC server. Some browsers interpret the change from the preselection to the URL indicated in the open element as cross-site scripting and prevent further processing or provoke an error.

Specify a base-url in the base-url element of the input message, e.g.

<base-url>
  https://www.google.com
</base-url>

Then, the open element must be identical with the `base-url `to prevent the error from occurring again.

Connection refused: connect

The Remote Control server does not run or the indicated server-/port address is not correct.

Check the availability of the Selenium RC server by pressing the Connection Test button in the dialog. The server is running if the response is Connection test was executed successfully and if a Firefox instance opens on the host where the RC server is installed.

For further information about the base-URL problem and cross-site scripting, refer to https://en.wikipedia.org/wiki/Same_origin_policy and refer to https://en.wikipedia.org/wiki/Cross-site_scripting.

Dialog Selenium Connector Properties

You use the dialog for connection details to enter access data for the Selenium Remote Control server and to configure connection details.

Selenium Remote Control Server

  • Server
    IP address or name of the Selenium Remote Control server

  • Port
    The Selenium Remote Control server uses port 4444.

  • Browser
    Browser that you want to open, including *.
    For an overview of the different browsers supported by Selenium, refer to https://www.selenium.dev/documentation/webdriver/browsers/.

  • Timeout (ms)
    Execution time in milliseconds. After expiration of the specified time period the test is aborted. Default value: 30.000ms. If you enter no value in the input field, the connector automatically adopts the default value.

    A test suite requiring a very long time span to run is disrupted prematurely by the timeout limitation specified here.
  • Capture screenshot in case of error
    If selected and an error occurs, a screenshot (base64-coded png file) is written as an error-screenshot element in the XML output message.

    If you insert e.g. a Decoder module as the subsequent module in the workflow, you can convert the base64- encoded screenshot file in a binary format and can, thus, forward it directly to a target application by using a File Output Connector.

Connection test

  • Test connection
    For testing whether the connection can be successfully established using your configuration.