npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

selenium-bootstrap

v0.3.0

Published

A Bootstrap for Selenium3.0. Just only install this, then you can use Selenium3.0

Readme

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

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

e.g.)

Features

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

Installation

yarn add selenium-bootstrap -D

or

npm i selenium-bootstrap -D

Usage

  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

index.js

const Selenium = require('selenium-bootstrap');
const selenium = new Selenium({
  browserName: 'chrome'
});
selenium.run(function* (driver, webdriver) {
  yield driver.get('http://www.google.com/ncr');
  yield driver.findElement(webdriver.By.name('q')).sendKeys('webdriver');
  yield driver.findElement(webdriver.By.name('btnG')).click();
  yield driver.wait(webdriver.until.titleIs('webdriver - Google Search'), 5000);
});
node index.js

selenium.run() 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

selenium.executeScript(func[, Arg1, Arg2, ...]);
selenium.executeScript(function(Arguments, are, available, at, here) {

  document.querySelector(".login-button").click();

  return [Arguments, are, available, at, here].join(' ');//Passed "Arguments are available at here;"
}, 'Arguments', 'are', 'available', 'at', 'here');

selenium.executeAsyncScript

selenium.executeAsyncScript(func[, Arg1, Arg2, ...]);
selenium.executeAsyncScript(function(Arguments, are, available, at, here) {
  var callback = arguments[arguments.length = 1];

  document.querySelector(".login-button").click();
 
  setTimeout(function() {
    callback([Arguments, are, available, at, here].join(" "))//Passed "Arguments are available at here;"
  }, 10000);
}, 'Arguments', 'are', 'available', 'at', 'here');

selenium.takeScreenshot

selenium.takeScreenshot(path);
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' or fs.writeFileSync` by yourself to save screenshot image..

options

port

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)

fullAuto

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

direct

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

v0.3.0
  • 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
v0.2.0
  • Added port Option used by selenium standalone server
v0.1.0
  • Launch this module

Dependencies