Quote:
Originally Posted by Quazar
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.
|
Looks cool, I'm going to be AFK for a few hours but later tonight I'm going to try and pick up where you left off.
One thing though, you can specify the verbosity of the script when executing it as opposed to making the script itself verbose by executing casperjs as such:
Code:
casperjs --log-level=debug --verbose mfc.js
No big deal though, but I personally would rather keep CasperJS quiet when the script is complete and have it only verbose for development...
Good work on figuring out how to switch to the frame. Last night I did try waitForSelector for a bit and now I know that it wasn't working because I wasn't drilling down into the frames.