Skip to content

Instantly share code, notes, and snippets.

@gooocho
Created June 13, 2013 05:26
Show Gist options
  • Save gooocho/5771427 to your computer and use it in GitHub Desktop.
Save gooocho/5771427 to your computer and use it in GitHub Desktop.
var page = require('webpage').create();
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open('http://localhost/test.html', function (status) {
// Check for page load success
if (status !== "success") {
console.log("Unable to access network");
} else {
// Execute some DOM inspection within the page context
page.evaluate(function() {
var testNode = document.getElementById('test');
var evt = document.createEvent('MouseEvents');
evt.initEvent('click', true, true);
testNode.dispatchEvent(evt);
});
}
phantom.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment