Skip to content

Instantly share code, notes, and snippets.

@ariya
Created March 16, 2012 20:05
Show Gist options
  • Save ariya/2052299 to your computer and use it in GitHub Desktop.
Save ariya/2052299 to your computer and use it in GitHub Desktop.
dump iframe content
var page = require('webpage').create();
page.settings.loadImages = false;
page.onConsoleMessage = function(msg) { console.log(msg); };
page.onLoadFinished = function() {
page.evaluate(function() {
var getFrames = function(doc) {
var frames = doc.querySelectorAll('iframe');
for (var i = frames.length - 1; i >= 0; i--) {
var fdoc = frames[i].contentWindow.document;
console.log(fdoc.body.innerText);
}
};
getFrames(document);
});
phantom.exit();
};
page.open(phantom.args[0]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment