-
Notifications
You must be signed in to change notification settings - Fork 0
/
pagetitle2.js
40 lines (27 loc) · 858 Bytes
/
pagetitle2.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
var system = require('system');
var args = system.args;
var url;
console.log('Before args length check');
if (args.length <= 1) {
console.log('No website specified.');
}
else {
for (var i=1; i < args.length; i++) {
url = args[i];
console.log(url);
var page = require('webpage').create();
console.log(url);
page.onConsoleMessage = function(msg) {
console.log(msg);
};
page.open(url, function(status) {
page.evaluate(function() {
console.log("hello");
console.log(document.title);
//title[i]=document.title;
//console.log(document.location + 'Page title is ' + title[i]);
});
});
}
}
phantom.exit();