How to create a #selenium script

Client Setup Instructions

  1. Open Firefox
  2. Search for the Selenium IDE plugin and install it.

Recording Selenium Script

*NOTE* This script WILL record passwords.

  1. Go to Tools -> Selenium IDE to launch the plugin
  2. The tool will default to recording on launch. (The recording button is the red button at the top right of the popup window.)
  3. Make sure you are set to record in HTML format and click away.
  4. When done, set the format to PERL and copy the script over to the server.
Editing the Selenium Script
  1. The editSelenium script is located on NIXON in /home/nagios/selenium/selenium_editors/editSelenium
  2. 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.
  3. 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:
  1. Find the check_selenium script in the libexec folder on the system (/usr/local/nagios/libexec/check_selenium on watcher).
  2. 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:
  1. Create/Find the check_selenium command in the Nagios GUI and mimic the command line given above.
Adding through NRPE:
  1. Find the nrpe.cfg file (/usr/local/nagios/etc/nrpe.cfg on watcher).
  2. Add the command at the bottom following the example of the other commands listed.
  3. In Nagios select check_nrpe as the command and add the command name as argument 1.

Subject: