This question already has an answer here:
This is a example in Github/Nightmare
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: true });
nightmare
.goto('http://yahoo.com')
.type('form[action*="/search"] [name=p]', 'github nightmare')
.click('form[action*="/search"] [type=submit]')
.wait('#main')
.evaluate(function () {
return document.querySelector('#main .searchCenterMiddle li a').href
})
.end()
.then(function (result) {
console.log(result)
})
.catch(function (error) {
console.error('Search failed:', error);
});
What's meaning of form[action"*=""/search"] in line 3?
Aucun commentaire:
Enregistrer un commentaire