Skip to content

Instantly share code, notes, and snippets.

@lai32290
Created March 23, 2018 14:49
Show Gist options
  • Save lai32290/59d76f73fe6d3be9894291176534367d to your computer and use it in GitHub Desktop.
Save lai32290/59d76f73fe6d3be9894291176534367d to your computer and use it in GitHub Desktop.
Ching Ling
const Nightmare = require('nightmare')
const nightmare = Nightmare({ show: true })
nightmare
.goto('http://blablablablabla/logon/logon.asp')
.wait(() => {
return document.querySelector('[name=username]') !== null;
})
.evaluate(() => {
document.querySelector('[name=username]').value = "visitante";
document.querySelector('[name=senha]').value = "visitante";
})
.wait(5000)
.end()
.then(console.log)
.catch(error => {
console.error('Search failed:', error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment