mirror of https://github.com/vitalif/phantomjs
useragent.js: Port to WebPage object.
parent
838b110e9e
commit
5f018b32b2
|
@ -1,8 +1,13 @@
|
|||
if (phantom.state.length === 0) {
|
||||
phantom.state = 'checking';
|
||||
phantom.userAgent = 'SpecialAgent';
|
||||
phantom.open('http://www.httpuseragent.org');
|
||||
} else {
|
||||
console.log(document.getElementById('myagent').innerText);
|
||||
var page = new WebPage();
|
||||
|
||||
page.open('http://www.httpuseragent.org', function (status) {
|
||||
if (status !== 'success') {
|
||||
console.log('Unable to access network');
|
||||
} else {
|
||||
var ua = page.evaluate(function () {
|
||||
return document.getElementById('myagent').innerText;
|
||||
});
|
||||
console.log(ua);
|
||||
}
|
||||
phantom.exit();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue