This article was written for version 7.0.4 of op5 Monitor, it could work on both lower and higher version if nothing else is stated.
Selenium is 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 setup Selenium Server on Microsoft Windows with Mozilla Firefox and configure test case monitoring.
Selenium Server, the check plugin and it's dependencies are third-party products, not supported by op5 AB
- Basic knowledge in Windows server administration
- The Selenium IDE installed in your web browser
- A working Internet connection for downloading dependencies
- Basic knowledge of service configuration in op5 Monitor
- A directory called "C:\selenium" and C:\selenium\testcases"
- The "NSClient++" monitoring agent installed on the target system
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.
Selenium Server requires some additional applications and runtimes:
Mozilla Firefox -
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 -
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 nice addition depending on your preferences
Python interpreter -
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.
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.
Installing Selenium Server
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:
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:
Preparing the monitoring agent
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":
Restart the NSClient++ system service to reload the configuration.
Exporting Selenium IDE test cases
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.
Configuring check command
Go to the "Commands" configuration page in op5 Monitor and create a new check command with the following options:
Monitoring test cases
Create a new service on your target host in op5 Monitor and select the "check_selenium_server" command.
The check command requires three arguments:
|$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|
It can take a few seconds for Selenium Server to start and the delay may differ depending on server load
Enter appropriate values and the save the configuration.
Once the service check has been executed, the status detail page should show something like this:
OP5 Monitor: Open Source Network Monitoring
OP5 is the preferred Open Source Networking & Server Monitoring tool for large multi-national companies in over 60 markets. If you would like to experience OP5 Monitor you can get started here, alternatively, if you prefer to get more hands on you can Download OP5 Monitor for free.
- Official Selenium documentation (External)
- Udemy: Learn Automated Testing with Selenium IDE (External)