mirror of https://github.com/vitalif/phantomjs
Use WebPage in useragent.coffee example.
parent
dcd91d73d1
commit
4f68bf7067
|
@ -1,7 +1,8 @@
|
|||
if phantom.state.length is 0
|
||||
phantom.state = 'checking'
|
||||
phantom.userAgent = 'SpecialAgent'
|
||||
phantom.open 'http://www.httpuseragent.org'
|
||||
else
|
||||
console.log document.getElementById('myagent').innerText
|
||||
phantom.exit()
|
||||
page = new WebPage()
|
||||
|
||||
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()
|
||||
|
|
Loading…
Reference in New Issue