Client Setup Instructions
- Open Firefox
- Search for the Selenium IDE plugin and install it.
Recording Selenium Script
*NOTE* This script WILL record passwords.
- Go to Tools -> Selenium IDE to launch the plugin
- The tool will default to recording on launch. (The recording button is the red button at the top right of the popup window.)
- Make sure you are set to record in HTML format and click away.
- When done, set the format to PERL and copy the script over to the server.
Editing the Selenium Script
- The editSelenium script is located on NIXON in /home/nagios/selenium/selenium_editors/editSelenium
- The command is ./editSelenium -f <FILENAME> -n <NEWFILE> -m <#>
<FILENAME> is the name of the unedited selenium script.
<NEWFILE> is the file the script will create that will contain the edited selenium script. It will also create a backup file that is pre-PerlTidy called <NEWFILE>.bak
<#> is the number of times the script will loop through trying to fix errors. It needs a minimum of 3 to run through completely. The larger the selenium script the more attempts it will most likely need. The number of attempts directly corresponds to the number of ajax loads there are on the page.
- The script will run through and tell you what it is doing every step of the way. Again, the longer the selenium test the longer the script will take since it actually runs the selenium test with each attempt.
The script adds TimePerf data for Nagios, If-else structure for cleaner exiting and execution, pauses/wait for loads, and browser location print outs.
*NOTE* The script is not flawless, it may not be able to edit the selenium script perfectly and may require some manual tweaking.
Running the Selenium Script
To run the selenium script without the wrapper (wrapper is described below), run "perl <NEWFILE>".
To run the selenium script with the wrapper do the following:
- Find the check_selenium script in the libexec folder on the system (/usr/local/nagios/libexec/check_selenium on watcher).
- The command for check_selenium is ./check_selenium -f <FILENAME> -d
<FILENAME> is the filename with path of the selenium script you want to run.
-d is the debug flag, this is optional. If you use this option then it will create a logfile with the selenium script's output EVERY time. by default it will create logs only when there has been an error.
Adding the Script to Nagios
Adding from Watcher:
- Create/Find the check_selenium command in the Nagios GUI and mimic the command line given above.
Adding through NRPE:
- Find the nrpe.cfg file (/usr/local/nagios/etc/nrpe.cfg on watcher).
- Add the command at the bottom following the example of the other commands listed.
- In Nagios select check_nrpe as the command and add the command name as argument 1.