Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. var Nightmare = require('nightmare');
  2. var nightmare = Nightmare({ show: true });
  3.  
  4. nightmare
  5. .goto('http://yahoo.com')
  6.  
  7. .then(function (result) {
  8. console.log(result)
  9. })
  10. .catch(function (error) {
  11. console.error('Search failed:', error);
  12. });
  13.  
  14.  
  15.  
  16.  
  17. .goto(url[, headers])
  18.  
  19. Loads the page at url. Optionally, a headers hash can be supplied to set headers on the goto request.
  20.  
  21. When a page load is successful, goto returns an object with metadata about the page load, including:
  22.  
  23. url: The URL that was loaded
  24. code: The HTTP status code (e.g. 200, 404, 500)
  25. method: The HTTP method used (e.g. "GET", "POST")
  26. referrer: The page that the window was displaying prior to this load or an empty string if this is the first page load.
  27. 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