I'd like to use CasperJS to load and navigate content from infinite scroll webpages. I saw the new scrollToBottom function and thought it would be a good way to do this. Unfortunately, I haven't gotten it to work.
Here's my reduced-to-the-simplest-thing-I-could-think-of code:
var casper = require('casper').create();
this.scrollToBottom();
this.wait(5000);
this.capture('boingboing.png');
});
casper.run();
The idea is that it scrolls to the bottom, waits long enough for one more screenful of content to load, and then captures it. Unfortunately, only the content that was loaded at the beginning, before any scrolling, appears in the capture.
I've tried this code and variants of it on several other sites, including Facebook and Twitter. It doesn't work anywhere. I've also seen
this blog post but that didn't get me anywhere either.
Is this a bug, or am I doing something wrong? What's the right way to handle infinite scroll in CasperJS?
Thanks,
Taymon