Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var page = require('webpage').create();
- console.log('The default user agent is ' + page.settings.userAgent);
- page.settings.userAgent = 'SpecialAgent';
- 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').textContent;
- });
- console.log(ua);
- }
- phantom.exit();
- });
Add Comment
Please, Sign In to add comment