Book Image

PhantomJS Cookbook

By : Rob Friesel
Book Image

PhantomJS Cookbook

By: Rob Friesel

Overview of this book

Table of Contents (15 chapters)
PhantomJS Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using WebdriverJS as a Selenium client for PhantomJS


This recipe demonstrates how to use WebdriverJS as a JavaScript-based Selenium client. We will run tests and discuss how to use the combination of WebdriverJS and PhantomJS for ubiquitous JavaScript.

Getting ready

To run this recipe, we will need a Selenium server available and running on our system; our recipe will use version 2.41.0 of the Selenium Java server, but we must use version 2.33.0 or later to be able to use GhostDriver.

Note

The Selenium Standalone Server JAR can be downloaded from the Selenium project website at http://docs.seleniumhq.org/download/.

Once downloaded, the server can be started (listening on port 4444 by default) with Java on the command line, as follows:

java -jar selenium-server-standalone-2.41.0.jar

Selenium is open source and distributed under the Apache License 2.0.

We will need WebdriverJS installed. WebdriverJS is a JavaScript-based Selenium client with a fluent API that implements the WebDriver wire protocol...