Hi everyone!
I'm trying to scrape an AJAX site and I'm having troubles. So, I have this code:
var casper = require('casper').create({
clientScripts: [ 'jquery.min.js' ]
});
casper.start("http://site.html");
casper.wait(10000, function() {
precio= this.getElementInfo('span[class=precio]').html;
console.log(price);
});
casper.run();
but when I run it I get this:
However, the element I need, it exists on the Google Chrome inspector:
This value exists after waiting like 7 seconds more or less, cause the site has a time out, so the price doesn't appear after waiting those seconds, that's why I have used "casper.wait()" but it looks like CasperJS is not able to find it though.
So, my question is: Why is CasperJS not able to get the price from that site? Am I doing it wrong by using HTML DOM, maybe?
Thank you in advance!
P.S: I don't want to give the url of the site for obvious reasons, so I've changed it to
"http://site.html", I hope it's not going to be needed for getting help.