2015-04-10 10:51:00 +03:00
|
|
|
"use strict";
|
2011-09-13 00:17:54 +04:00
|
|
|
var page = require('webpage').create();
|
2011-05-28 09:50:33 +04:00
|
|
|
console.log('The default user agent is ' + page.settings.userAgent);
|
|
|
|
page.settings.userAgent = 'SpecialAgent';
|
2011-05-26 01:29:20 +04:00
|
|
|
page.open('http://www.httpuseragent.org', function (status) {
|
|
|
|
if (status !== 'success') {
|
|
|
|
console.log('Unable to access network');
|
|
|
|
} else {
|
|
|
|
var ua = page.evaluate(function () {
|
2018-05-30 16:16:45 +03:00
|
|
|
return document.getElementById('qua').value;
|
2011-05-26 01:29:20 +04:00
|
|
|
});
|
|
|
|
console.log(ua);
|
|
|
|
}
|
2010-12-27 10:12:31 +03:00
|
|
|
phantom.exit();
|
2011-05-26 01:29:20 +04:00
|
|
|
});
|