Created
June 13, 2013 05:26
-
-
Save gooocho/5771427 to your computer and use it in GitHub Desktop.
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 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