Created
May 13, 2013 11:42
-
-
Save souri/5567743 to your computer and use it in GitHub Desktop.
This time using https://github.com/alexscheelmeyer/node-phantom module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var phantom=require('node-phantom'); | |
phantom.create(function(err,ph) { | |
ph.createPage(function(err,page) { | |
page.setFn('onInitialized', function() { | |
console.log("In initialized"); | |
page.evaluate(function(domContentLoadedMsg) { | |
document.addEventListener('DOMContentLoaded', function() { | |
window.callPhantom('DOMContentLoaded'); | |
}, false); | |
}); | |
}); | |
page.setFn('onLoadStarted', function() { | |
console.log("We are now inside onLoadStarted"); | |
}); | |
page.setFn('onLoadFinished', function() { | |
console.log("We are now inside onLoadFinished"); | |
}); | |
page.setFn("onDOMContentLoaded", function() { | |
console.log("We are now inside DOMContentLoaded. Awesome!"); | |
ph.exit(0); | |
}); | |
page.onCallback = function(data) { | |
console.log("DOMContentLoaded!"); | |
//ph.exit(0); | |
}; | |
page.open("http://tilomitra.com/repository/screenscrape/ajax.html"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment