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 🙏

© 2026 – Pkg Stats / Ryan Hefner

selenium-page

v1.0.11

Published

A superset class for simpler access to most common functionalities Selenium-Webdriver

Readme

Selenium-Page

Selenium-Page is an superset of Selenium-Webdriver.

The main feature are Intellisense and the easy access to WebElements, Switch Frames, wait elements not been visible, error handlers and screenshot on errors.

I'm working on it on my free time. Feel free to suggest improvements.

Installation

Selenium-Page may be installed via npm with

npm i selenium-webdriver
npm i selenium-page

Also, download the driver for browser that you want to work with, as per @selenium-webdriver#installation

You will need to download additional components to work with each of the major browsers. The drivers for Chrome, Firefox, and Microsoft's IE and Edge web browsers are all standalone executables that should be placed on your system [PATH]. Apple's safaridriver is shipped with Safari 10 for OS X El Capitan and macOS Sierra. You will need to enable Remote Automation in the Develop menu of Safari 10 before testing.

| Browser | Component | | ----------------- | ---------------------------------- | | Chrome | [chromedriver(.exe)][chrome] | | Internet Explorer | [IEDriverServer.exe][release] | | Edge | [MicrosoftWebDriver.msi][edge] | | Firefox | [geckodriver(.exe)][geckodriver] | | Opera | [operadriver(.exe)][operadriver] | | Safari | [safaridriver] |

Usage

A Demo of Selenium-Page using Mocha can be found in the demo directory.

Bellow are same features samples.

const { Page, Key, PageDefs } = require("selenium-page")

(async function example() {
  
  const objPage = new Page()
  await objPage.open("https://www.google.com")
  await (await objPage.driver).getTitle()
  await (await objPage.findBy.name("q")).sendKeys(searchingText, Key.RETURN)
  const searchResults = await objPage.findAllBy.css("#search .g")
  await objPage.close()

})()

Features

Class Page

When instantiate the a Page object you may send as parameter a PageDefinition object. It tell the driver how to work in general, such as browser, browser arguments (parameters), resolution and default Page.findBy behave.

const { Page, Key, PageDefs } = require("selenium-page")

const objPage = new Page()

//the same as 

const objPage = new Page({
  browser: PageDefs.browsers.chrome,
  browserArgs: [],
  browserCapability: [
    {
      prop: "setPageLoadStrategy", 
      value: "normal"
    }
  ],
  findConfig: {
    dataTestAttr: "data-test",
    screenshot: true
  },
  resolution: PageDefs.resolutions.maximize
})

Page Properties

Page.findBy encapsulate the object Selenium-Webdriver By, you can access all the By options. It will return a Promise<WebElement>. Eg. of <div id='12345'>ACME Content</div>

const el = await objPage.findBy.id("12345")
//or
const el = await objPage.findBy.css("#12345")

If the element is not found, it will raise an exception. The error will display what's the By selector not found. eg By: By(css selector, #12345). Also an screenshot can be taken at the moment of the error. The screenshot is set to True by default on Page constructor, as mentioned above.

You can also add some parameters on the findBy, such as error message or delays to find the element.

const el = await objPage.findBy.id("12345", "Div 12344 was not found")
//or
const el = await objPage.findBy.css("#12345", {
  message: "Div 12344 was not found",
  timeoutMs: 2000,
  waitBeVisible: true,
  waitBeEnabled: true,
  waitBeEnabledMs: 2000,
  screenshotName: "",
  message: "",
  mustFind: true
  }
)

Page.findAllBy similar to Page.findBy, but search for all WebElements that match the selector. It will return a Promise<WebElement[]>. Eg. of <div class='myClass'>ACME 1</div><div class='myClass'>ACME 2</div>

const els = await objPage.findAllBy.css("myClass")
console.log(els.length) // 2

Page.switchToFrame Provide the Frames or iFrames WebElement that you want the WebDriver to switch to. Use the switchToFrame.toDefault function to return to default frame.

const iFrame = await objPage.findBy.xpath("//iframe")
await objPage.switchToFrame.element(iFrame)
...
await objPage.switchToFrame.toDefault()

Page.waitDisappearBy will wait until the element not be displayed or the timeout.

await objPage.waitDisappearBy.id("12345", {timeoutMs: 3000, message: "Div 12344 was still displayed after 3 seconds"})

Page.By direct access to selenium-webdriver By
Page.until direct access to selenium-webdriver until