Book Image

Learning Behavior-driven development with Javascript

Book Image

Learning Behavior-driven development with Javascript

Overview of this book

Table of Contents (17 chapters)
Learning Behavior-driven Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing in several browsers with WebDriver


There is no need for a special tool to be able to run your test in different browsers. We can do so using WebDriverJS. Let's have a look.

Testing with PhantomJS

We can change our tests to execute them against PhantomJS (http://phantomjs.org/). PhantomJS is a headless WebKit that can be accessed and programmed using JavaScript. The point of using a headless browser such as PhantomJS is that it will neither open a window nor render anything on the screen during your tests. Using a headless browser can make your tests run slightly faster, because the browser does not need to open a window process and wait for the HTML to be rendered.

Tip

An alternative to using PhantomJS would be to install and configure XVFB (http://www.x.org/releases/X11R7.6/doc/man/man1/Xvfb.1.xhtml).

Currently, PhantomJS has built-in support for WebDriver. In the previous versions, there was a need to install a special plugin called GhostDriver for PhantomJS (https://github.com/detro...