Node.js WebDriver client from the Selenium project
Drive PhantomJS 1.8+ from Node.js using Selenium's WebDriver
This module provides a simple wrapper around the Node.js WebDriver implementation that ships with Selenium.
npm install selenium-node-webdriver
phantomjs --webdriver=4444 &node node_modules/selenium-node-webdriver/examples/hello.js
This example (
examples/hello.js) queries Google for 'webdriver' and returns
the titles of the results.
var WebDriver = ;;
The module exports a factory function which accepts a config object and returns a promise. The config object has two properties, both of which are optional:
server: describes the WebDriver server to connect to; it has the following
host: the server's hostname (localhost)
port: the port to connect to (4444)
retries: the number of times to try to connect to the server (5)
delay: the delay in ms between connection attempts (500)
capabilities: describes the
of the WebDriver client you are creating. It has the following properties by
The returned promise is resolved with a RemoteWebDriver instance if the connection succeeds or rejected with the error from the final retry if connection fails.