Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nightmare-window-manager

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nightmare-window-manager

nightmare-window-manager ====================== Add window management to your [Nightmare](http://github.com/segmentio/nightmare) scripts.

  • 0.2.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

nightmare-window-manager

Add window management to your Nightmare scripts.

Usage

Simply require the library:

var Nightmare = require('nightmare')
require('nightmare-window-manager')(Nightmare)

... and then enable the window manager with .windowManager(). It should be the first call in your Nightmare chain.

.windowManager()

Sets up window management.

.windows()

Gets a listing of the windows currently open under the Nightmare instance.

.waitWindowLoad()

Waits for all of the windows to no longer be in a loading state.

.currentWindow()

Gets the current window.

.closeWindow(windowId)

Closes the window specified by the window ID. If the current window is the one being closed, the first non-closed window is set as focused. WARNING: do not close the ID 1 as that will dispose the Nightmare plumbing.

focusWindow(windowId)

Sets the given window ID as focused.

evaluateWindow(fn[, arg1, arg2, ...])

Invokes fn on the currently selected window with the arguments supplied. All of the arguments are optional. On completion, it returns the return value of fn, same as Nightmare's .evaluate().

Example

var Nightmare = require('nightmare');
require('nightmare-window-manager')(Nightmare);
var nightmare = Nightmare();
nightmare
    .windowManager()
    .goto(url)
    .click('#something_opens_a_window')
    .waitWindowLoad()
    .currentWindow()
    .then(function(window){
          //window contains useful information about the newly-opened window,
          //including the window ID
          console.dir(window)
    });

Keywords

FAQs

Package last updated on 22 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc