Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.


You can test against any Selenium-supported browser by setting properties inside ~/, or passing them as Java properties to the JVM. But by default the tests will run using the Phantomjs headless Chrome Headless browser. This means that this needs chrome and chromedriver need to be installed on whatever station DomUI is built on - see the Phantomjs website for details., as follows:

  • Install Chrome as usual
  • Download the latest chromedriver from here.
  • Unzip the file. This will give you a single file, "chromedriver".
  • Copy this file to some directory on your PATH, like /usr/bin for Linux, or ~/bin if you have no rights.

Using Headless Chrome

Since Chrome 59 we can also use Chrome in headless mode, and as PhantomJS development has been abandoned this is now the default.

There are some issues with using chrome. The most important issue is that ChromeDriver/Chrome does not properly take screenshots. Unlike the other drivers chrome takes only partial screenshots of the page, and that breaks some tests and makes bugs harder to find.

To circumvent this issue the DomUI wrapper around WebDriver has a special implementation of the code that creates a screenshot for Chrome. The code is described on Stackoverflow.

Alternative: using Phantomjs

You can also use PhantomJS as the headless test platform. Just install the "phantomjs" executable in some directory in your PATH, and define webdriver.hub=phantomjs in or on the command line (-Dwebdriver.hub=phantomjs).

Sadly enough PhantomJS is no longer supported because the main developer quit 8-/


Please install phantomjs from the website, and do not use your distribution's version of it (so do not use apt-get). The distributions often distribute handicapped versions causing odd test failures.


I moved to Phantomjs because its alternative, htmlunit, does not allow screenshots to be taken from the pages, and this makes a lot of tests hard to use. But it can still be used, with the effect that some tests will not really work.

Test helper base classes

The DomUI code wraps Selenium in a few helper classes that help with easier testing of DomUI code. See the provided JUnit tests for details. These classes are thin wrappers around WebDriver itself so missing functionality is easily added.


For this we can use Selenium/Phantomjs's ability to take screenshots. Using screenshots of a rendered page we can load the screenshot, then use Selenium's knowledge of the position and size of a web page element to extract from the screenshot the actual rendering of the component as a bitmap. This bitmap can then be further analyzed.