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

nightmare-iframe-manager

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nightmare-iframe-manager

delegates commands to iframes in Nightmare

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

nightmare-iframe-manager

Add inline iframe management to your Nightmare scripts.

Credit

Original idea was thanks to @tiangolo in segmentio/nightmare#496.

WARNING

This plugin overrides Nightmare's internal evaluate_now method to wrap the page's document variable. This is dangerous and fragile. After entering an iframe, certain functionality may not work as expected. Read the pull in the credit link for more information. You have been warned.

Usage

Require the library, passing the Nightmare constructor as a parameter:

var Nightmare = require('nightmare');
require('nightmare-iframe-manager')(Nightmare);

... and that's it. You should now be able to enter and exit iframes.

.enterIFrame(selector)

Enter an iframe with the given selector. All subsequent requests will go through that iframe until .exitIFrame() or .resetFrame() is called.

.exitIFrame()

Exits the current selector to the previous one. If exiting the last selector, this exits to the root document.

.resetFrame()

Resets all frames and restores the root document.

Example

var Nightmare = require('nightmare');
require('nightmare-iframe-manager')(Nightmare);
var nightmare = Nightmare();
nightmare.goto('http://example.com')
  .enterIFrame('#someIFrame')
  .title()
  .then(function(title){
    // `title` is the title of the child frame #someIFrame
  })

Keywords

FAQs

Package last updated on 04 Aug 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