Web scenario tests using Selenium
You need to install Firefox Selenium IDE extension. You can get it HERE
When you got this file, you have to install it in Firefox:
Click on Tools -> Add-ons
On Add-ons page, select Install Add-on from file...*
Select selenium-ide-2.8.0.xpi file on your system
Click on Install Now to install extensions
You have to change the default configuration of your Firefox Selenium IDE extention.
To open Selenium IDE window, click on Tools -> Selenium IDE
In Selenium IDE window, open settings by clicking on Options > Options
Then go on Locator Builders tab
Note
You have to put the link item to the bottom of the list
This is an example how to create a new web scenario.
This scenario runs on http://savoirfairelinux.com:
Now, you can continue your scenario following this example.
Warning
Please read Recommendations
When you have finished your scenario, you can save it. This is highly recommended because, this is the only way to edit the scenario in the future ...
To save the sceario, click on File > Save test Case
In order to use the scenario with the check_selenium plugin, you need to export the scenario to a Python file.
Click on File > Export Test Case As... > Python 2 /unitest / WebDriver
Warning
Use only LOWER CASE letters (a-z) when you export a scenario !!!!!
Note
This file will be used by the check_selenium plugin
Warning
Be carefull about site language:
So, default site language could be FR/ES/DE with YOUR Firefox but it could EN with “vanilla” Firefox profile.
Danger
Also, when you want to wait a text, choose preferally:
This plugin need:
You can install it, with:
pip install -r requirements.txt
Show help
$ ./check_selenium -h
Launch scenario
$ ./check_selenium -S scenarios -s savoirfairelinuxcom
OK: Scenario execution time: 4.57 seconds
If you get an error/bug in your scenario with the plugin, you can launch it in debug mode. In debug mode, Firefox will be launched on your display. You will be able to see what Firefox does.
$ ./check_selenium -S scenarios -s savoirfairelinuxcom -d
OK: Scenario execution time: 4.57 seconds
You can also set the size of your Firefox use -W and -H options. This is usefull for scenario on mobile web site.
$ ./check_selenium -S scenarios -s savoirfairelinuxcom -W 400 -H 800
OK: Scenario execution time: 4.57 seconds
Here, the example of command which can be used in your shinken configuration. Don’t forget to add -f option to get perfdata and get graph.
$ $USER1$/check_selenium -S $SCENARIOS_FOLDER$ -s $ARG1$ -w $ARG2$ -c $ARG3$ -f