At the very least, everywhere the Yahoo example is used, it would be good to have a quick description, e.g. “here’s how to get the URL for the top result in a Yahoo search for ‘github nightmare’.”
Line-by-line comments describing each action probably aren’t needed, but could be helpful for someone just getting started, e.g:
nightmare
// load a URL
.goto('http://yahoo.com')
// simulate typing into an element identified by a CSS selector
.type('input[title="Search"]', 'github nightmare')
// click the search button
.click('#uh-search-button')
// wait for results to load
.wait('#main')
// run some javascript inside the webpage to get the URL of the first link
.evaluate(function() {
return document.querySelector('#main .searchCenterMiddle li a')
.href;
})
Line-by-line comments certainly won't hurt and cost (almost) nothing outside of a small time investment. A quick description of what the example does wouldn't hurt, either. Will do. :)
At the very least, everywhere the Yahoo example is used, it would be good to have a quick description, e.g. “here’s how to get the URL for the top result in a Yahoo search for ‘github nightmare’.”
Line-by-line comments describing each action probably aren’t needed, but could be helpful for someone just getting started, e.g: