mirror of https://github.com/vitalif/phantomjs
12 lines
371 B
CoffeeScript
12 lines
371 B
CoffeeScript
page = require('webpage').create()
|
|
|
|
console.log 'The default user agent is ' + page.settings.userAgent
|
|
|
|
page.settings.userAgent = 'SpecialAgent'
|
|
page.open 'http://www.httpuseragent.org', (status) ->
|
|
if status isnt 'success'
|
|
console.log 'Unable to access network'
|
|
else
|
|
console.log page.evaluate -> document.getElementById('myagent').innerText
|
|
phantom.exit()
|