Created
December 6, 2011 11:16
-
-
Save padcom/1437829 to your computer and use it in GitHub Desktop.
PhantomJS example
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
// ---------------------------------------------------------------------------- | |
// Page object setup | |
// ---------------------------------------------------------------------------- | |
var page = new WebPage(); | |
page.onConsoleMessage = function(msg) { | |
console.log(msg); | |
}; | |
page.open(encodeURI("http://jquery.com/"), function (status) { | |
page.evaluate(test); | |
phantom.exit(); | |
}); | |
// ---------------------------------------------------------------------------- | |
// Test section | |
// ---------------------------------------------------------------------------- | |
function test() { | |
console.log($("div").length); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment