Automated testing with Selenium part II

We are starting with test automation and after a selection of tools; we decided to go with Selenium. An open source tool for user interface testing for web applications.

Features that are important in the Selenium tool

  •  Record & playback interface for quick scripting and low learning curve.
  •  The record & playback interface is working as a plug-in in Firefox.
  •  There is a plug-in for Record and Playback to do loops in IDE scripts, but is limited
  •  There is a plug-in for data driven testing
  •  Selenium is usable with open source programming platforms (such as Ruby or Python)

Combination with Python

For now within LeaseWeb we experimented with the Python development platform. Python is also open Source software, with a low learning curve. When the scripts are programmed (or imported from Record and Playback IDE interface) it can be used for more sophisticated automated testing. For example read data from a database and check this against web software.

When this is setup with Selenium webdriver you can do cross browser platform automated checking.

  • Cross browser and cross-platform
  • Performance testing by using basic test scenarios

Install Selenium IDE (the record and playback tool)
Go to http://seleniumhq.org/ and follow the instructions on that page for installing Selenium IDE
Install the Selenium webdriver

Get Python

  • Download Python from www.python.org (please install Python 2.x, not Python 3.x, this new version has little support yet)

Add Python to your PATH

  • Right click on “My Computer”.
  • Select “Properties” from the context menu.
  • In the “System Properties” dialog box, click on the “Advanced” tab.
  • Click on the “Environment Variables” button.
  • Highlight the “Path” Variable in “System variables” section.
  • Click the “Edit” button.
  • Append the following lines to the text inside the “Variable value” text box semi-colon delimited.
  • C:\Python25\;C:\Python25\Scripts\ (where 25 is the version number of your downloaded Python version)
  • Click “OK” on the “Edit System Variable” dialog box then “OK” on the “Environment Variables” dialog box to commit the changes.

Install setuptools
Download setuptools via http://pypi.python.org/pypi/setuptools#downloads
The file “setuptools-x.x.win32-pyx.x.exe (md5)” is an executable that will self extract and setup the setuptools.

Install Python
For the next step you’ll need Python 2 installed, which you can get from http://www.python.org/getit/. You’ll also need to install setuptools from http://pypi.python.org/pypi/setuptools.
Once you have these, you can run the following to install the Selenium python client library:
– easy_install pip
– pip install selenium

Support for browsers
At the time of writing this only the Firefox and Chrome webdrivers work (1st of November 2011). This is because of the webdriver is a new platform for Selenium. The old Selenium platform (Selenium RC and Selenium Grid) are used now in lots of companies, but within Leaseweb we decided to use the new one. This is something for the near future to experiment with within Leaseweb.
Install Google Chrome driver and Internet Explorer
If you want to play around with the Selenium Webdriver and some other browsers than Firefox, you will have to install the drivers for these web browsers.

  • Google Chrome: you should download the chrome driver and place in a system path (you could for example put the driver in the c:\pythonxx folder)
  • For Internet Explorer you will have to turn on ALL security zones: Turn ON protected mode in ALL Internet Explorer Zones (Security Tab in IE settings)

Conclusion
The new version of Selenium is better and more user friendly than the old version, but the compatibility with web browsers is not good enough yet. But for learning and starting with this tool it is good enough. Reasonably sophisticated scripts can be made in combination with Python as a programming environment, what makes it very flexible. Selenium is updated a lot, so in near future I guess all the internet browsers will work.

Share

One thought on “Automated testing with Selenium part II”

  1. I’m not sure I follow your conclusion. Are you saying that Selenium’s IDE isn’t browser compatible, or that Selenium WebDriver isn’t compatible with other browsers. The former I can understand because they’ve never made any claims that I’ve seen that the IDE will be browser compatible. However, the IDE is just the tip of the iceberg as far as what you can do with Selenium. If you aren’t afraid to get your hands dirty in a little code, the Selenium WebDriver APIs can target IE, FireFox, Chrome, Safari, and several mobile browsers. (There are probably other browsers it can target that I’ve just not used as much as well.) So to conclude I disagree with your conclusion, because if all you plan to do is write tests with the IDE, then you are missing out on the robust and rich framework that Selenium 2 can provide.

Leave a Reply

Your email address will not be published. Required fields are marked *