I'm a newbie, recently started to use phantomjs with casperjs. I want to get info from an iframe but phantomjs fails to load it.
This is my script:
var casper = require('casper').create({
verbose: true,
logLevel: "debug",
waitTimeout: 20000,
retryTimeout: 100,
viewportSize: {
width: 1920,
height: 1080
},
pageSettings: {
"userAgent": 'Mozilla/5.0 (Windows NT 6.0) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.41 Safari/535.1'
},
localToRemoteUrlAccessEnabled: true
});
casper.start();
casper.open('http://www.badboysbarber.ru/online');
casper.waitForSelector('.y-main-container', function() {
this.echo("Selector appeared.");
});
casper.then(function() {
this.capture('screen.png');
});
casper.run();
So, phantom throws an error (although selector is defined correctly):
[error] [phantom] Wait timeout of 20000ms expired, exiting.
Could somebody help me please? Maybe I'm doing something wrong? Thank you.
An
iframe
loads a document inside another document. If you want to work with frames and use CasperJS to get data, you will probably needwithFrame()
inCasper.prototype
.The following script captures the raw HTML content of the first
iframe
in your main page: