The Drupal Selenium Integration module is a heavily modified version of the possibly-defunct Drupal Selenium project.
Besides restored functionality and many added features, it also includes several modifications to naturalize the Selenium module to Drupal, and to better integrate it with SimpleTest-style testing.
The Drupal Selenium Integration module requires several pieces of software to be installed on your computer before testing can begin:
- Selenium server
- One or more web browsers (Firefox and Chrome are currently supported).
- A display buffer of some kind for the browsers to work from.
Install the module using standard Drupal methods
Optionally, copy D7-core-selenium.patch, found in the module's root folder, to the Drupal root folder, and run the patch:
patch -p1 < D7-core-selenium.patchThis may be required for slower systems that take more time for the browser window to render.
Download and run the Selenium server .jar:
curl "url_to_the_selenium_jar_download" > selenium.jar
java -jar selenium.jar # You should probably redirect this (to /dev/null, for example), e.g. by tacking >& /dev/null & at the end.This will start a Selenium server on port 4444.
For systems that have no natural display buffer, a virtual display buffer, such as X Virtual Frame Buffer (XVFB), may be required to start browsers from.
To install XVFB on Debian-based systems:
sudo apt-get -y install xvfb
curl "url_to_the_selenium_jar_download" > selenium.jar"
DISPLAY=:1 xvfb-run java -jar ~/selenium.jar # Similarly, this should probably be redirected.This will also start a Selenium server on port 4444.
The Drupal Selenium Integration module can be configured on your site at admin/config/development/testing/settings.
The Selenium server host and port section allows you to specify where the Selenium server is hosted at. The page will attempt to establish a connection to that server, obtain its status, and let you know if any issues were encountered.
Allowed Selenium Browsers is a list of comma-and-space-separated browsers that tests consider to be valid for spinning up. The browsers 'firefox' and 'chrome' are handled especially by the module, and any others are handled by a generic driver that attempts to instantiate a Selenium session using it. THIS FEATURE SHOULD BE USED AT YOUR OWN RISK, although to be fair, the only 'risk' really is that your tests will get sad yellow and red messages and you might have to clean up the failed tests from the database.
- Firefox simply needs to be installed and should run through Selenium without any trouble. For more information and troubleshooting, you can check https://code.google.com/p/selenium/wiki/FirefoxDriver.
- Chrome requires the Selenium chromedriver to be installed before it will run tests. Links to the download for the chromedriver, as well as more information and troubleshooting, can be found here: https://code.google.com/p/selenium/wiki/ChromeDriver.
