This is as far as I will get today. Another 30min spent without making any headway...
Code:
var casper = require('casper').create({
verbose: true,
logLevel: 'error',
pageSettings: {
userAgent: 'Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.2 Safari/537.36'
}
});
var x = require('casper').selectXPath
casper.start('http://myfreecams.com/', function() {
this.echo(this.getTitle());
this.page.switchToChildFrame(0);
});
casper.then(function() {
casper.echo("Waiting for age gate...");
casper.waitForSelector('#enter_desktop');
casper.click('#enter_desktop');
casper.echo("Entered.");
});
casper.then(function() {
casper.echo("Selecting model container...");
this.page.switchToChildFrame(0);
// foreach modelRow in online_broadcasters_list
// if !modelRow.isLoaded
// scroll down
//
// foreach model in modelRow
// fetch data
});
casper.run();
There "switchToChildFrame" are necessary because the model list is situated within an iframe, which itself sits in another iframe.