This module integrates Drupal with the Selenium test tool.

Integration of Selenium with simpletest. All tests can run in 2 modes, depending on a browser:

  • Firefox and Chrome can work both on original site and against simpletest sandbox
  • Opera and Internet Explorer can only work on original site

Both modes are launched via standard Simpletest interface.



Selenium Webdriver is completely different product then Selenium 1 RC and tests should be written manually (not recorded with Selenium IDE). However we try to keep API similar to general drupal simpletests (DrupalWebTestCase class). Our aim is to create most of the methods from DrupalWebTestCase so tests can be written similar way we write unit tests.

Selenium 2 communicates with browsers in 'native way' i.e. it is not javascript framework like in Selenium 1. This gives us possibility to do completely all actions user can do in browser. This includes upload files, drag and drop, submit forms, test all ajax javascripts, make screenshots.

We can get all properties of every dom element of the page. We can find elements using sizzle library selectors (this library is used by jQuery). Example: "div.header" -- Find all links with class "active" in all div blocks with class .header.

Our aim is to implement all methods DrupalWebTestCase. So current tests can be run in Selenium instead of internal web browser.

Current functionality of Selenium module has already a lot of methods implemented including:
1. drupalLogin, drupalLogout
2. asserts: assertLink, assertTitle, assertText, assertNoText
3. verboseScreenshot -- grab screenshot
4. drupalGet, drupalPost

All other functionality can be reached using connection to Driver (class SeleniumFirefoxDriver, SeleniumChromeDriver) and using element control (class SeleniumWebElement).

Module includes tests for following core javascripts:

  • autocomplete.js
  • collapse.js
  • machine_name.js
  • states.js
  • tabledrag.js
  • tableheader.js
  • tableselect.js
  • textarea.js
  • vertical_tabs.js

7.x-3.x branch

Thanks to neochief we have opened 7.x-3.x branch that has integration with simpletest 2.x.
This branch is made recommended since it has all the functionality of 7.x-2.x and tended not to have any problems with core Simpletest. There is a special issue to put feedback about using it with core Simpletest: #1886780: Make 7.x-3.x recommended

How much does it cost?

It is absolutely free. But you have the opportunity to contribute to the implementation of new features or speed up the closure of the bug that annoys you, or just to thank the developers.
Support this module to make new features to be implemented faster:

Project resources


PatchRanger - the first crowdfunded Drupal freelancer:
Flattr PatchRanger

Supporting organizations: 
Initial development

Project information