Skip to content

nightmare with node.js support in webview, and no side-effect.

Notifications You must be signed in to change notification settings

lwdgit/node-nightmare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fork from nightmare

Features

  • support require nodejs modules ( use with to deal with conflicts perfectly)
  • default import jquery@3.1.1
  • add show & hide api

install

> npm install --save node-nightmare

example

const Nightmare = require('node-nightmare')
Nightmare({show: false}) 
  .show()
  .goto('https://google.com')
  .wait('input[type="submit"]')
  .insert('input[name="q"]', 'node-nightmare github.com')
  .click('input[type="submit"]')
  .wait(1000)
  .wait('#resultStats')
  .end()
  .evaluate(function() {
      let text = $('a:contains("node-nightmare")').text();
      require('fs').writeFileSync('./results.txt', text);
      return require('shelljs').cat('./results.txt').stdout;//you should install shelljs in your workspace
      // default require saved in __NODE namespace, but you can use it directly in `evaluate` scope
  })
  .then(function(ret) {
     console.log(ret)
  }).catch(function(e) {
     console.log(e)
  })

default require saved in __NODE namespace, but you can use it directly in evaluate scope

About

nightmare with node.js support in webview, and no side-effect.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages