zero_shubham1

constructor

Oct 9th, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var page = require('webpage').create();
  2. console.log('The default user agent is ' + page.settings.userAgent);
  3. page.settings.userAgent = 'SpecialAgent';
  4. page.open('http://www.httpuseragent.org', function(status) {
  5.   if (status !== 'success') {
  6.     console.log('Unable to access network');
  7.   } else {
  8.     var ua = page.evaluate(function() {
  9.       return document.getElementById('myagent').textContent;
  10.     });
  11.     console.log(ua);
  12.   }
  13.   phantom.exit();
  14. });
Add Comment
Please, Sign In to add comment