node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


A Bootstrap for Selenium3.0 to run E2E Testing more conveniently.

I recommend to use this with manager of Selenium Standalone Server,



Generator & Yield are supported

  • If you specify generator function , it is run like co basically

Better APIs than Native Webdriver

  • selenium.executeScript
  • selenium.executeAsyncScript
  • etc is under implementing...(real click api, wait api)
  • of course, native webdriver api is fully inherited

if fullAuto options is set to true, you don't need setup other specials for Selenium except for this

Originally, below things is required to be worked Selenium.

When your script run...

  • Required resources is downloaded & installed with Selenium Standalone(from NPM Module) at only first time.
  • Start and Stop Selenium Standalone automatically


yarn add selenium-bootstrap -D


npm i selenium-bootstrap -D


  1. Install with yarn add selenium-bootstrap or npm i selenium-bootstrap -D
  2. Write and run code like below
  3. Selenium and Browser get started


const Selenium = require('selenium-bootstrap');
const selenium = new Selenium({
  browserName: 'chrome'
});* (driver, webdriver) {
  yield driver.get('');
  yield driver.findElement('q')).sendKeys('webdriver');
  yield driver.findElement('btnG')).click();
  yield driver.wait(webdriver.until.titleIs('webdriver - Google Search'), 5000);
node index.js is an simple API which launch Browser. Both of generator function and normal function with prommise are supported.(Below example is written generator function) And only argument is capabilities which is able to be specified in the same way as native Webdriver for NodeJS.

  • driver argument is newed built instance from selenium-webdriver module.
  • webdriver argument is imported variable from selenium-webdriver module.

More examples

In most cases, Generator is better than Promise chain.

Custom Wrapper APIs (better then native Webdriver APIs)

Problem of driver.executeScript and driver.executeAsyncScript

The problem is that they are should to be passed as string like below.

driver.executeScript('document.querySelector(".login-button").click();return [Arguments, are, available, at, here].join(" ");');
driver.executeAsyncScript('var callback = arguments[arguments.length = 1];document.querySelector(".login-button").click();setTimeout(function() {callback([Arguments, are, available, at, here].join(" "))}, 10000);')


selenium.executeScript(func[, Arg1, Arg2, ...]);
selenium.executeScript(function(Arguments, are, available, at, here) {
  return [Arguments, are, available, at, here].join(' ');//Passed "Arguments are available at here;" 
}, 'Arguments', 'are', 'available', 'at', 'here');


selenium.executeAsyncScript(func[, Arg1, Arg2, ...]);
selenium.executeAsyncScript(function(Arguments, are, available, at, here) {
  var callback = arguments[arguments.length = 1];
  setTimeout(function() {
    callback([Arguments, are, available, at, here].join(" "))//Passed "Arguments are available at here;" 
  }, 10000);
}, 'Arguments', 'are', 'available', 'at', 'here');


selenium.takeScreenshot('./my_screenshot/hoge.png');// -> save screenshot into specified path 
  • path is optional. if not set, saved under cwd as filename which named based on url.
  • Emulating fullpage screenshot with scrolling page for browsers which is not support fullpage screenshot(e.g. chrome).
  • Unnecessary to write fs.writeFile' orfs.writeFileSync` by yourself to save screenshot image..



By default, it is referred to selenium standalone server

const selenium = new Selenium({
  browserName: 'chrome'
}, {
  port: '9999',
  • port is used selenium server(default port number is 4444)


const selenium = new Selenium({
  browserName: 'chrome'
}, {
  fullAuto: true,

When your script run...

  • Required resources is downloaded & installed with Selenium Standalone(from NPM Module) at only first time.
  • Start and Stop Selenium Standalone automatically
  • port is available at the same time


const selenium = new Selenium({
  browserName: 'chrome'
}, {
  direct: true
  • if direct is set to true, run webdriver directly(not using selenium standalone server)

Easy to use with Cloud Services for Remote or Multi Devices Testing

If you specify the service unique capability, then you can use these services.

They are awesome cloud testing services using real browsers and devices.

Change log

  • Support for Browsers on Windows OS
  • Added direct Option for selecting whether to use webdriver for the browser directly(Default: false)
  • Added fullAuto Option for running with downloading and installing full automatically
  • Added port Option used by selenium standalone server
  • Launch this module