Files: d456a6cc8589489e558e6164750474ed2cfc961e / test / test-79-npm / nightmare / nightmare.js
590 bytesRaw
1 | ; |
2 | |
3 | var Nightmare = require('nightmare'); |
4 | var nightmare = new Nightmare({ show: false }); |
5 | |
6 | nightmare |
7 | .goto('http://yahoo.com') |
8 | .type('form[action*="/search"] [name=p]', 'github nightmare') |
9 | .click('form[action*="/search"] [type=submit]') |
10 | .wait('#main') |
11 | .evaluate(function () { |
12 | // nightmare takes thisFunction.toString(), so --public |
13 | // is needed (or placing this file to assets) |
14 | return document.querySelector('#main .searchCenterMiddle li a').href; |
15 | }) |
16 | .end() |
17 | .then(function (result) { |
18 | if (result.indexOf('segmentio') >= 0) console.log('ok'); |
19 | }); |
20 |
Built with git-ssb-web