O'Reilly logo

Mastering Selenium WebDriver by Mark Collin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Going headless

Going headless seems to be all the rage these days, so let's have a look at how we can add GhostDriver into the mix. We already have pretty much all of the code we need, so this is just going to be a few minor tweaks. Let's start off by updating our POM to bring in a dependency on GhostDriver:

<dependency>
    <groupId>com.codeborne</groupId>
    <artifactId>phantomjsdriver</artifactId>
    <version>1.2.1</version>
</dependency>

GhostDriver depends upon PhantomJS. This is another binary that most people will not have by default, but that's fine; the driver-binary-downloader plugin can get it for us.

Tip

This is not the official PhantomJSDriver distribution, but it fixes an error that came in with Selenium 2.44.0. Keep an eye on the group ID

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required