2011-06-09 19:11:39 +04:00
|
|
|
// Read the Phantom webpage '#intro' element text using jQuery and "includeJs"
|
|
|
|
|
2011-09-13 00:17:54 +04:00
|
|
|
var page = require('webpage').create();
|
2011-06-09 19:11:39 +04:00
|
|
|
|
|
|
|
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();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|