I am trying to scrape a web page. There is an ajax button (a div) on site, when clicked it appends the list on page with more results (like showing 20 more results). I want to click it 3 times.
Using the code below:
casper.then(function() {
for(var i=1; i<=3; i++){
casper.evaluate(function(){
$("div.showMore").click();
return true;
})
casper.wait(5000, function then(){
this.capture('image.png');
})
}
})
but it just captures the page without the click. I am sure that the this code clicks..
$("div.showMore").click();
I checked it by pushing/trying it via chrome console.
So what am i missing?