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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nemo-window

v1.0.3

Published

Browser window extensions for Nemo automation. A plugin for Nemo.

Downloads

7

Readme

nemo-window

nemo-window is a plugin for [Nemo] (https://github.com/paypal/nemo) automation framework. It provides methods to work with multiple browser-windows.

Installation

npm install nemo-window --save-dev

Configuration

Add nemo-window plugin to your config/config.json under plugins section.


    	"plugins": {
		    "window": {
		        "module": "nemo-window"
		    }
		 ...
	},
	...

Methods

	nemo.window.switchTab	: switches focus to other window
	nemo.window.switchFrame	: switches focus to new frame on page
	nemo.window.newWindow	: opens new window
	nemo.window.close		: close current window
	nemo.window.handles		: retrieve all window handles from session
	nemo.window.handle		: retrieve current window handle
	nemo.window.mainHandle	: retrieve parent window handle

switchTab(windowHandle)

Switches focus to particular Window/Tab in browser.

  • If windowHandle is not provided, switches focus alternatively.
  • If windowHandle is provided, switches focus to particular window handle.

@argument windowHandle {String} (Optional)

@returns {Web driver Promise}

Usage:
1. nemo.window.switchTab(); //switches focus alternatively

   e.g. if two windows, Window A and Window B, are open

        nemo.window.switchTab(); //switch focus to Window B
        nemo.window.switchTab(); //switch focus to Window A
        nemo.window.switchTab(); //switch focus back to Window B

2. nemo.window.switchTab('CD-W-2F3449'); //switches focus to window handle `CD-W-2F3449`

Please find the example at the end.

switchFrame(nameOrIndex)

Switches focus to another frame on page. nameOrIndex is required argument.

Please find the example at the end.

@argument nameOrIndex {String} (Required)

@returns {Web driver Promise}

Usage:
nemo.window.switchFrame('paypalTarget'); //switch focus to particular frame 'paypalTarget' on page

close()

Closes current window (and focus on an other window)

Please find the example at the end.

@returns {Web driver Promise}

Usage:
nemo.window.close(); //close the current window
Usage:
nemo.window.closeAll(); //close all the windows

newWindow(url, name)

Opens new window in browser and automatically switches focus to new window. Navigates to the Url automatically if url is provided. It is Optional. Name the new Window if name is provided. It is Optional.

Please find the example at the end.

@arguments url {String} (Optional) @arguments name {String} (Optional)

Usage:
1. nemo.window.newWindow(); //opens new window in browser, and switches focus to new Window
2. nemo.window.newWindow('www.paypal.com/signin'); //opens new window in browser and automatically navigates to `www.paypal.com/signin`
3. nemo.window.newWindow('www.paypal.com/signin', 'ppWindow'); //In addition to [2], it names the new window as `ppWindow`

handles()

Retrieve the list of all window handles available to the session.

@returns {Array of the window handles as a Promise}

Usage:
nemo.window.handles().then(callback);

mainHandle()

Retrieve main/parent window handle

Please find the example at the end.

@returns {main/parent window handle as a Promise}

Usage:
nemo.window.mainHandle().then(callback);

handle()

Retrieve current window handle

Please find the example at the end.

@returns {current window handle as a Promise}

Usage:
nemo.window.handle().then(callback);

Example


//this example assumes that window[A] is already launched by nemo

//launch new window[B] and navigate to PayPal.com. Note: it automatically switches focus to new window[B]
nemo.window.newWindow('http://www.paypal.com');

//get new window[B] handle
nemo.window.handle().then(callback);

//get main window[A] handle
nemo.window.mainHandle().then(callback); //returns main window handle

//switch to window[A], no need to provide handle if only two windows are open. it switches alternatively
nemo.window.switchTab(); //focus is on window[A]

//switch to window[B]
nemo.window.switchTab(); //focus is on window[B]

//close window[B] since the current focus is on window[B]. Note: it automatically switches focus to window[A]
nemo.window.close(); //close currently focused window

//this returns window[A] handle
nemo.window.handle().then(callback); //returns window[A] handle