Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
dominos-scrape-example.js
var Nightmare = require('nightmare');
var nightmare = Nightmare({ show: true });
nightmare
.goto('https://www.dominos.com/en/')
.wait('.btn--delivery')
.click('.btn--delivery')
.wait('input#Street')
.wait(1000)
.type('input#Street[type=\'text\'][name=\'Street\']', 'Made Up Street Address')
.type('input#City', 'Denver')
.select('select#Region', 'CO')
.type('label[for=\'Postal_Code\']', '80203')
.click('button.btn--large[type=\'submit\']')
.wait(2000)
.evaluate(function (result, done) {
var deliveryError = document.querySelector('.errorText')
if (deliveryError) {
return deliveryError.innerHTML;
} else {
return 'A pizza can be delivered to you!'
}
})
.end()
.then(function (result) {
console.log(result)
})
.catch(function (error) {
console.error('Search failed:', error);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.