Set Javascript Negotiated Capabilities

197 views
Skip to first unread message

willia...@digital.hmrc.gov.uk

unread,
Jan 19, 2015, 10:51:21 AM1/19/15
to phan...@googlegroups.com
Hello,

I'm attempting to turn javascript off when using PhantomJs with GhostDriver, I have tried various ways of doing this such as: 

val capabilities = DesiredCapabilities.phantomjs()
capabilities
.setCapability("phantomjs.page.settings.javascriptEnabled", false)
Driver.webDriver = new PhantomJSDriver(capabilities)


However when I look at the logs when running my tests I see the following:

[INFO  - 2015-01-19T15:40:05.041Z] Session [707184e0-9ff1-11e4-97ec-615db725aa4d] - page.settings - {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":false,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.8 Safari/534.34","webSecurityEnabled":true}
[INFO  - 2015-01-19T15:40:05.041Z] Session [707184e0-9ff1-11e4-97ec-615db725aa4d] - page.customHeaders:  - {}
[INFO  - 2015-01-19T15:40:05.041Z] Session [707184e0-9ff1-11e4-97ec-615db725aa4d] - Session.negotiatedCapabilities - {"browserName":"phantomjs","version":"1.9.8","driverName":"ghostdriver","driverVersion":"1.1.0","platform":"windows-7-32bit","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"}}


As you can see where I have highlighted the page settings have changed but the Session.negotiatedCapabilities settings have not changed, therefore Javascript has not been turned off.

How would I change this setting?

Thanks,

William Smith

Rohan

unread,
Jul 13, 2015, 10:12:52 PM7/13/15
to phan...@googlegroups.com
Were you able to figure out a solution to the above issue ?
Reply all
Reply to author
Forward
0 new messages