How do I turn off the logging for PhantomJS in Watir-WebDriver?
Asked Answered
G

0

2

I see a lot of logging information for PhantomJS in my ruby (1.8) watir code, i.e INFO messages. How do I turn it off ? I got the Java code from google search but not ruby code. Java PhantomJSDriver disable all logs in console

PhantomJS is launching GhostDriver...
[INFO  - 2015-01-27T10:00:00.000Z] GhostDriver - Main - running on port 8910
[INFO  - 2015-01-27T10:00:00.000Z] Session [30344df0-a7de-11e4-9220-5bf7aac4a098] - _decorateNewWindow - page.settings: {"XSSAuditingEnabled":false,"javascriptCanCloseWindows":true,"javascriptCanOpenWindows":true,"javascriptEnabled":true,"loadImages":true,"localToRemoteUrlAccessEnabled":false,"userAgent":"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534.34 (KHTML, like Gecko) PhantomJS/1.9.1 Sa
fari/534.34","webSecurityEnabled":true}
[INFO  - 2015-01-27T10:00:00.000Z] Session [30344df0-a7de-11e4-9220-5bf7aac4a098] - page.customHeaders:  - {}
[INFO  - 2015-01-27T10:00:00.000Z] Session [30344df0-a7de-11e4-9220-5bf7aac4a098] - CONSTRUCTOR - Desired Capabilities: {"javascriptEnabled":true,"rotatable":false,"version":"","takesScreenshot":true,"cssSelectorsEnabled":true,"browserName":"phantomjs","nativeEvents":false,"platform":"ANY"}
[INFO  - 2015-01-27T10:00:00.000Z] Session [30344df0-a7de-11e4-9220-5bf7aac4a098] - CONSTRUCTOR - Negotiated Capabilities: {"browserName":"phantomjs","version":"1.9.1","driverName":"ghostdriver","driverVersion":"1.0.4","platform":"windows-7-32bit","javascriptEnabled":true,"takesScreenshot":true,"handlesAlerts":false,"databaseEnabled":false,"locationContextEnabled":false,"applicationCacheEnabled":f
alse,"browserConnectionEnabled":false,"cssSelectorsEnabled":true,"webStorageEnabled":false,"rotatable":false,"acceptSslCerts":false,"nativeEvents":true,"proxy":{"proxyType":"direct"}}
[INFO  - 2015-01-27T10:00:00.000Z] SessionManagerReqHand - _postNewSessionCommand - New Session Created: 30344df0-a7de-11e4-9220-5bf7aac4a098



# All your code print statements go here !




[INFO  - 2015-01-27T10:00:00.000Z] ShutdownReqHand - _handle - About to shutdown
Guttapercha answered 23/1, 2015 at 19:22 Comment(8)
What is the -1 for ? There is no code for this. There can be no code. What have I tried ? I have googled and got a java solution to turn logs off as I already mentioned.Guttapercha
Some people just like to downvote.Bev
Can you give an example of the messages you are seeing? PhantomJS does not appear to be outputting anything by default for me.Rutabaga
@JustinKo - I tried to peek into the source code using the instructions for java and js as a clue. I wasted 2 hours and found nothing like STDOUT, console, log etc. which could be commented out to fix this issue.Guttapercha
Just to make sure I am trying to reproduce the right issue, these logs are generated when simply doing Watir::Browser.new :phantomjs?Rutabaga
@JustinKo - Wow ! Thats good. To test that, I put print statements before and after the my code browser = Watir::Browser.new :phantomjs. Only the before print statement shows output, code executes correctly and ends. Why does this happen ?Guttapercha
watir uses webdriver to talk to phantomjs.. webdriver communicates with phantomjs via ghostdriver. The docs for ghostdriver stuff are (I am told) part of the webdriver project. try looking there for options perhaps?Baggywrinkle
@ChuckvanderLinden - Please tell me where I can look for the options you mentioned. thanks.Guttapercha

© 2022 - 2024 — McMap. All rights reserved.