mirror of https://github.com/vitalif/phantomjs
20 lines
551 B
JavaScript
20 lines
551 B
JavaScript
|
// Read the Phantom webpage '#intro' element text using jQuery and "includeJs"
|
||
|
|
||
|
var page = new WebPage();
|
||
|
|
||
|
page.onConsoleMessage = function(msg) {
|
||
|
console.log(msg);
|
||
|
};
|
||
|
|
||
|
page.open("http://www.phantomjs.org", function(status) {
|
||
|
if ( status === "success" ) {
|
||
|
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
|
||
|
page.evaluate(function() {
|
||
|
console.log("$(\"#intro\").text() -> " + $("#intro").text());
|
||
|
});
|
||
|
phantom.exit();
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|