Skip to content

Instantly share code, notes, and snippets.

@brettscott
Created February 20, 2014 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettscott/9115796 to your computer and use it in GitHub Desktop.
Save brettscott/9115796 to your computer and use it in GitHub Desktop.
Output of test_ghostdriver_useragent.sh
[root@pal bin]# ./test_ghostdriver_useragent.sh
=== TEST #1 ===
phantomjs.page.settings.userAgent: iphone
=== START SESSION ===
/session :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 581
Content-Type: application/json;charset=UTF-8
{"sessionId":"642caa00-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.userAgent":"iphone"}}
SessionId: 642caa00-9a40-11e3-a109-31d3b92b6acc
=== REQUEST PAGE ===
/url :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 74
Content-Type: application/json;charset=UTF-8
{"sessionId":"642caa00-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{}}
=== OBTAIN PAGE ELEMENT CONTENTS ===
/element :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 104
Content-Type: application/json;charset=UTF-8
{"sessionId":"642caa00-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"ELEMENT":":wdc:1392908717621"}}
/element/:wdc:1392908717621/text :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 80
Content-Type: application/json;charset=UTF-8
{"sessionId":"642caa00-9a40-11e3-a109-31d3b92b6acc","status":0,"value":"iphone"}
Actual User-Agent: "iphone" * Correct
=== TEST #2 ===
phantomjs.page.settings.userAgent: firefox
=== START SESSION ===
/session :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 582
Content-Type: application/json;charset=UTF-8
{"sessionId":"68c0d820-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.userAgent":"firefox"}}
SessionId: 68c0d820-9a40-11e3-a109-31d3b92b6acc
=== REQUEST PAGE ===
/url :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 74
Content-Type: application/json;charset=UTF-8
{"sessionId":"68c0d820-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{}}
=== OBTAIN PAGE ELEMENT CONTENTS ===
/element :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 104
Content-Type: application/json;charset=UTF-8
{"sessionId":"68c0d820-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"ELEMENT":":wdc:1392908719759"}}
/element/:wdc:1392908719759/text :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 80
Content-Type: application/json;charset=UTF-8
{"sessionId":"68c0d820-9a40-11e3-a109-31d3b92b6acc","status":0,"value":"iphone"}
Actual User-Agent: "iphone" * Wrong (should be "firefox")
=== TEST #3 ===
phantomjs.page.settings.userAgent: safari
=== START SESSION ===
/session :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 581
Content-Type: application/json;charset=UTF-8
{"sessionId":"6a0788f0-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.userAgent":"safari"}}
SessionId: 6a0788f0-9a40-11e3-a109-31d3b92b6acc
=== REQUEST PAGE ===
/url :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 74
Content-Type: application/json;charset=UTF-8
{"sessionId":"6a0788f0-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{}}
=== OBTAIN PAGE ELEMENT CONTENTS ===
/element :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 104
Content-Type: application/json;charset=UTF-8
{"sessionId":"6a0788f0-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"ELEMENT":":wdc:1392908721347"}}
/element/:wdc:1392908721347/text :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 80
Content-Type: application/json;charset=UTF-8
{"sessionId":"6a0788f0-9a40-11e3-a109-31d3b92b6acc","status":0,"value":"iphone"}
Actual User-Agent: "iphone" * Wrong (should be "safari")
=== TEST #4 ===
phantomjs.page.settings.userAgent: iphone
=== START SESSION ===
/session :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 581
Content-Type: application/json;charset=UTF-8
{"sessionId":"6af9d830-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"browserName":"phantomjs","version":"1.9.2","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"linux-unknown-64bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":false,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"},"phantomjs.page.settings.userAgent":"iphone"}}
SessionId: 6af9d830-9a40-11e3-a109-31d3b92b6acc
=== REQUEST PAGE ===
/url :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 74
Content-Type: application/json;charset=UTF-8
{"sessionId":"6af9d830-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{}}
=== OBTAIN PAGE ELEMENT CONTENTS ===
/element :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 104
Content-Type: application/json;charset=UTF-8
{"sessionId":"6af9d830-9a40-11e3-a109-31d3b92b6acc","status":0,"value":{"ELEMENT":":wdc:1392908723243"}}
/element/:wdc:1392908723243/text :
Response:
HTTP/1.1 200 OK
Cache: no-cache
Content-Length: 80
Content-Type: application/json;charset=UTF-8
{"sessionId":"6af9d830-9a40-11e3-a109-31d3b92b6acc","status":0,"value":"iphone"}
Actual User-Agent: "iphone" * Correct
[root@pal bin]#
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment