https://github.com/lwdgit/node-nightmare
nightmare with node.js support in webview, and no side-effect.
https://github.com/lwdgit/node-nightmare
nightmare node-nightmare
Last synced: 4 months ago
JSON representation
nightmare with node.js support in webview, and no side-effect.
- Host: GitHub
- URL: https://github.com/lwdgit/node-nightmare
- Owner: lwdgit
- Created: 2017-03-09T07:41:52.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-23T14:18:53.000Z (over 8 years ago)
- Last Synced: 2025-01-04T19:11:55.431Z (6 months ago)
- Topics: nightmare, node-nightmare
- Language: JavaScript
- Homepage:
- Size: 125 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Changelog: History.md
Awesome Lists containing this project
README
# Fork from [nightmare](https://github.com/segmentio/nightmare)
## Features
* support require nodejs modules ( use `with` to deal with conflicts perfectly)
* default import [email protected]
* add show & hide api
## install```bash
> npm install --save node-nightmare
```## example
```javascript
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