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

nightwatch-custom-commands

v1.0.8

Published

Some nightwatch custom commands which doesnt work natively

Readme

Custom Commands for nightwatchJS which can't be handled natively

This package allows you to perform some custom commands which natively fails in nightwatch.

Commands Available :

1. Custom Click -

Use when nighwatch native click fails

Usage
it('Usage of custom click',  client => {
  client.customClick('#locatorValueAsString', "Custom Message" )
});

// pageObject is reference to your page object
it('Usage of custom click',  client => {
  pageObject.customClick('@locatorReference', "Custom Message")
  pageObject.customClick('#locatorValueAsString', "Custom Message" )
});

//from inside page object
this.customClick('@locatorReference', "Custom Message")
this.customClick('#locatorValueAsString', "Custom Message" )

@method customClick

@param {string|Object} definition The selector (CSS/Xpath) used to locate the element. Can either be a string or an object which specifies element properties.

@param {string} [msg] Optional log message to display in the output. If missing, one is displayed by default.

2. Is Element Present -

Check if an element is present and returns true or false.

Usage
it('Usage of is Elem present',  client => {
  if( client.isElemPresent('@locatorReference', 6000, "Custom Message")){
     //perform some action
  } else {
     // perform some other action
 }
    if( client.isElemPresent('#locatorReference', 6000, "Custom Message")){
    //perform some action
  } else {
     // perform some other action
 }
  });

@method isElemPresent

@param {string|Object} definition The selector (CSS/Xpath) used to locate the element. Can either be a string or an object which specifies element properties.

@param {number} [time] Time in milliseconds to wait for the element to be present, By default waits for 2000 milliseconds

@param {string} [msg] Optional log message to display in the output. If missing, one is displayed by default.

@returns {boolean}

3. Custom Log -

When console.log() is used from nightwatch tests , it makes asynchronous call. Use customLog() to replicate synchronous behaviour. Helpful for debugging

Usage
it('Usage of customLog',  client => {
  ------code---
  client.customLog("Custom Message")
});

@method customLog @param {string} definition The log message which needs to be printed

4. Is Element In Viewport -

Check if an element is in viewport and returns true or false. Useful to test scenarios when clicking on certain tile lands on certain section of the webpage. Also can be used to certain certain section is anchored while scrolling the webpage

Usage
 it('Usage of isElementInViewport',  client => {
    if(client.isElementInViewport('css locator'))
 
  });

@method isElemInViewport

@param {string} definition The selector (CSS) used to locate the element. Supports only css for now

@returns {boolean} Can be true or false depending on if the element is in active view in browser

5. wheel scroll to element -

Use selenium wheel action to scroll to a certain webelement

Usage
  it('Usage of customWheelScrollToView',  client => {
    client.customWheelScrollToView('css locator/selenium webelement')
 
  });

@method customWheelScrollToView

@param {string/object} definition The selector (CSS) or selenium webelement used to locate the element.

Installation

For nightwatch v2, install

npm i nightwatch-custom-commands

Configuration

Add custom command to your nightwatch.conf.js. You can refer the nightwatch documentation

custom_commands_path: ['./node_modules/nightwatch-custom-commands/command' ],