Use WebPage in useragent.coffee example.

1.2
rgieseke 2011-05-26 11:08:33 +02:00
parent dcd91d73d1
commit 4f68bf7067
1 changed files with 8 additions and 7 deletions

View File

@ -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()