Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var Horseman = require('node-horseman');
- var horseman = new Horseman();
- horseman
- .open('http://www.amazon.com/gp/site-directory/')
- .waitForSelector(childSel(2,5,20))
- .evaluate(function(selector){
- var test = [];
- for (i = 1; i < jQuery(selector).size(); i++){
- test[i - 1] = jQuery(selector).eq(i).html().attr('href')
- }
- return test
- }, '#shopAllLinks > tbody > tr > td:nth-child(2) > div:nth-child(5) > ul > li')
- .then(function(val){
- console.log(val);
- return horseman.close();
- })
- /*.html(childSel(2,5,20))
- .log()
- .close()*/
- function childSel(sel1, sel2, sel3){
- return '#shopAllLinks > tbody > tr > td:nth-child(' + sel1 + ') > div:nth-child(' + sel2 + ') > ul > li';
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement