CasperJS can't find an element from an AJAX site

62 views
Skip to first unread message

AdrianT95

unread,
Jul 31, 2018, 7:45:30 AM7/31/18
to CasperJS
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.


Message has been deleted

AdrianT95

unread,
Feb 19, 2019, 2:30:23 PM2/19/19
to CasperJS
Alright, we can mark my question as solved I guess... Nobody has replied me after 7 months and I found a better alternative that works better than CasperJS for my case and it has a more helpful & active community...

Bye.
Reply all
Reply to author
Forward
0 new messages