Guest User

Untitled

a guest
May 2nd, 2016
83
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var Horseman = require('node-horseman');
  2. var horseman = new Horseman();
  3.  
  4. horseman
  5. .open('http://www.amazon.com/gp/site-directory/')
  6. .waitForSelector(childSel(2,5,20))
  7.  
  8. .evaluate(function(selector){
  9. var test = [];
  10. for (i = 1; i < jQuery(selector).size(); i++){
  11. test[i - 1] = jQuery(selector).eq(i).html().attr('href')
  12. }
  13. return test
  14. }, '#shopAllLinks > tbody > tr > td:nth-child(2) > div:nth-child(5) > ul > li')
  15.  
  16. .then(function(val){
  17. console.log(val);
  18. return horseman.close();
  19. })
  20.  
  21. /*.html(childSel(2,5,20))
  22. .log()
  23. .close()*/
  24.  
  25. function childSel(sel1, sel2, sel3){
  26. return '#shopAllLinks > tbody > tr > td:nth-child(' + sel1 + ') > div:nth-child(' + sel2 + ') > ul > li';
  27. }
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×