Browser testing using Selenium - tooltwist/documentation GitHub Wiki

There are many tools available for testing an application via it's browser interface. The most popular however is Selenium, and we use this due to it's support for many different browsers.

The best way to get familiar with Selenium is to try out this example project: https://github.com/meza/webdriver-js-example

To run this project, you'll also need to download a browser driver for Selenium. The easiest to use is probably Chrome Driver, for the Google Chrome Browser, which can be downloaded here.

Headless Browser

A "Headless browser" is a browser that can be run without a desktop window. For testing this is useful, because the tests can be run in the background, without taking control of the user's machine. Testing on these browsers is often also faster, as the web pages don't actually need to be displayed. In all other ways however, a headless browser (should) run exactly the same as a regular browser.

Selenium uses PhantomJS as it's headless browser. This is based upon WebKit, the underlying browser of both Safari and Google's Chrome browser.

Types of Tests

Selenium can drive the browser in several ways.

Selenium IDE allows test cases to be defined interactively, by defining scripts that will be run. This is great for creating functional tests, an an easy way to learn Selenium.

[Selenium WebDriver] provides an API that allow programs to operate the Browser. This is especially useful for Behaviour Driven Development (e.g. tests using Cucumber).

Links

Selenium

http://docs.seleniumhq.org

ChromeDriver

http://code.google.com/p/selenium/wiki/ChromeDriver
http://code.google.com/p/chromedriver/downloads/list

PhantomJS

http://phantomjs.org
https://github.com/ariya/phantomjs
https://github.com/ariya/phantomjs/wiki

--