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) {
|
var page = new WebPage();
|
||||||
phantom.state = 'checking';
|
|
||||||
phantom.userAgent = 'SpecialAgent';
|
page.open('http://www.httpuseragent.org', function (status) {
|
||||||
phantom.open('http://www.httpuseragent.org');
|
if (status !== 'success') {
|
||||||
} else {
|
console.log('Unable to access network');
|
||||||
console.log(document.getElementById('myagent').innerText);
|
} else {
|
||||||
|
var ua = page.evaluate(function () {
|
||||||
|
return document.getElementById('myagent').innerText;
|
||||||
|
});
|
||||||
|
console.log(ua);
|
||||||
|
}
|
||||||
phantom.exit();
|
phantom.exit();
|
||||||
}
|
});
|
||||||
|
|
Loading…
Reference in New Issue