Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Nightmare = require('nightmare');
- var nightmare = Nightmare({ show: true });
- nightmare
- .goto('http://yahoo.com')
- .then(function (result) {
- console.log(result)
- })
- .catch(function (error) {
- console.error('Search failed:', error);
- });
- .goto(url[, headers])
- Loads the page at url. Optionally, a headers hash can be supplied to set headers on the goto request.
- When a page load is successful, goto returns an object with metadata about the page load, including:
- url: The URL that was loaded
- code: The HTTP status code (e.g. 200, 404, 500)
- method: The HTTP method used (e.g. "GET", "POST")
- referrer: The page that the window was displaying prior to this load or an empty string if this is the first page load.
- headers: An object representing the response headers for the request as in {header1-name: header1-value, header2-name: header2-value}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement