Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
REMitchell
GitHub Repository: REMitchell/python-crawling
Path: blob/master/6-Selenium/phantomjs/examples/phantomwebintro.js
164 views
1
// Read the Phantom webpage '#intro' element text using jQuery and "includeJs"
2
3
var page = require('webpage').create();
4
5
page.onConsoleMessage = function(msg) {
6
console.log(msg);
7
};
8
9
page.open("http://www.phantomjs.org", function(status) {
10
if ( status === "success" ) {
11
page.includeJs("http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js", function() {
12
page.evaluate(function() {
13
console.log("$(\".explanation\").text() -> " + $(".explanation").text());
14
});
15
phantom.exit();
16
});
17
}
18
});
19
20
21