Back to OP5 Monitor FAQ

How to set up Selenium Server on Microsoft Windows

Version Compatibility Copied

This article was written for version 7.0.4 of OP5 Monitor; it could work on both lower and higher versions if nothing else is stated.

Introduction Copied

Selenium is a browser automation framework used for testing web pages and applications. It is similar to the WebInject application included in OP5 Monitor, but includes an IDE which allows the user to build complex test cases executed by browsers like Google Chrome and Internet Explorer.

This how-to will show you how to set up Selenium Server on Microsoft Windows with Mozilla Firefox and configure test case monitoring.

Support information Copied

Selenium Server, the check plugin and its dependencies are third-party products, not supported by ITRS Group.

Prerequisites Copied

Note: Firefox Plugin “Selenium IDE” is not supported in the Firefox browser beginning from version 55. (https://www.ghacks.net/2017/08/21/selenium-ide-firefox-add-on-end-of-live/) webdriver should be used.

Software dependencies Copied

Selenium Server requires some additional applications and runtimes:

Mozilla Firefox - Copied

The Firefox web browser will be used as the web driver in this how-to and can be downloaded from the Mozilla foundation’s website.

Oracle Java - Copied

Selenium Server requires the Java runtime environment, which can be downloaded from Oracle’s website.

The “Ask toolbar” provided in the Java installation wizard is not required by Selenium Server, but might be a nice addition depending on your preferences.

Python interpreter - Copied

The check plugin for Selenium test cases requires the Python interpreter, version 2.X. You can download it from the Python software foundations website.

Make sure to enable the “Add Python.exe to path” option in the installation wizard.

NSSM - Copied

Selenium server does not include any service management out-of-the-box. NSSM is an application which turns Windows and Java executables into system services.

You can download NSSM via their official website or via Chocolatey.

Installing Selenium Server Copied

Download Selenium Server version 2.x from the SeleniumHQ and move the JAR-file to “C:\selenium”. Open the command prompt as administrator in extracted NSSM directory and execute the following commands to install the service:

.\nssm.exe install selenium-server java -jar C:\selenium\selenium-server-standalone-2.45.0.jar -interactive.\nssm.exe start selenium-server

It’s highly recommended to create a dedicated user for the Selenium Server service to minimize security risks.

You will also need to install the Selenium Python module for the test cases. Open the command prompt as administrator and execute the following PIP command:

pip.exe install selenium

Preparing the monitoring agent Copied

Create a directory in “C:\Program Files\op5\NSClient++\scripts” called “custom” and copy the “check_selenium_win-APLHA” plugin to it. Open a text editor as administrator and add the following lines to “C:\Program Files\op5\NSClient++\custom.ini”:

[NRPE Handlers]check_selenium=python.exe scripts\custom\check_selenium_win-ALPHA.py -s "$ARG1$" -w "$ARG2$" -c "$ARG3$"

Restart the NSClient++ system service to reload the configuration.

Exporting Selenium IDE test cases Copied

Once you have created a test case, open “Export Test Case As…” in the “File” menu and select “Python 2 / unittest / WebDriver”. Save the file and copy it to the “C:\selenium\testcases” directory on your target system.

OP5 Monitor - How to set up Selenium Server on Microsoft Windows

Configuring check command Copied

Go to the “Commands” configuration page in OP5 Monitor and create a new check command with the following options:

command_name:   check_selenium_servercommand_line:   $USER1$/check_nrpe -u -H '$HOSTADDRESS$' -t 50 -c check_selenium -a '$ARG1$' '$ARG2$' '$ARG3$'

OP5 Monitor - How to set up Selenium Server on Microsoft Windows

Monitoring test cases Copied

Create a new service on your target host in OP5 Monitor and select the “check_selenium_server” command. The check command requires three arguments:

Argument Description
$ARG1$ File name of Selenium test case in Python unittest format
$ARG2$ Warning threshold in seconds for test execution time
$ARG3$ Critical threshold in seconds for test execution time

Threshold levels

It can take a few seconds for Selenium Server to start and the delay may differ depending on server load.

Enter appropriate values and then save the configuration.

OP5 Monitor - How to set up Selenium Server on Microsoft Windows

Once the service check has been executed, the status detail page should show something like this:

OP5 Monitor - How to set up Selenium Server on Microsoft Windows

Additional information Copied

["Geneos"] ["FAQ"]

Was this topic helpful?