I'm looking to scrape a page as an exercise to learn phantomjs however I'm having an issue currently. The image loading is deferred so I'm trying to figure out how I can get phantom js to scroll down and wait for the images to load. SCrolling to the bottom of the page doesnt work so I was thinking of scrolling 100px every 3 seconds until it gets to the bottom of the page. How would I achieve this with?
const phantom = require('phantom');
(async function() {
const instance = await phantom.create();
const page = await instance.createPage();
await page.on('onResourceRequested', function(requestData) {
console.info('Requesting', requestData.url);
});
await page.open(<URL>);
const js = await page.includeJs('http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js');
const data = await page.evaluate(function() {
// Do something
});
page.render('test.pdf');
await page.close();
await instance.exit();
})();