Setting up webdriver-sync


Setting up webdriver-sync for web testing with node.js

What is webdriver-sync?

Webdriver is a product of the Selenium project which provides an interface to an automation engine embedded in most modern browsers.

There are clients available in various languages to enable you to write scripts for webdriver. Webdriver-sync is a client for node.js that allows scripts to be written in a procedural, synchronous style.

Installing webdriver-sync

Webdriver-sync can be installed on Linux, OSX and Windows (note that installation on Windows is initially painful due the dependency on node-java which itself entails installing part of VisualStudio). Instructions are on the linked github page and here - just be careful about selecting the correct version of each component.

Using webdriver-sync from node.js

Webdriver-sync is simply required by your test script, then you run it as a normal node.js CLI application. See the github page for examples.

Internet Explorer 11

Make sure "Protected Mode" is enabled for all zones and add your site(s) to the Trustes Sites list.

Keeping webdriver-sync up to date

Browser versions change frequently and the corresponding webdriver clients have to keep pace with these changes.

One of the nice things about webdriver-sync is that after the initial install it handles all these dependencies for you. Keep webdriver-sync up to date via npm and it downloads and installs any necessary driver updates for you.

Webdriver-sync capabilities

Your webdriver scripts will instantiate a browser then navigate to and interact with websites using selectors and events (just as you would in client-side javascript). You can also execute javascript in the browser at run-time (to parse variables in running code, check response headers, etc). A little bit of trickery will also enable you to test uploads and downloads.

Webdriver is essentially a node.js wrapper around the java client, which is documented here.

Don't worry too much about trying to dig through all that detail. We will be developing a DSL to abstract away from the low-level stuff.

Next: Using multiple OSes and devices