Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silencing ChromeDriver.exe logging

I am running ruby unit tests against Chrome using watir-webdriver. Whenever a test is run and chromedriver.exe is launched output similar to below appears:

Started ChromeDriver
port=9515
version=26.0.1383.0
log=C:\Home\Server\Test\Watir\web\chromedriver.log
[5468:8796:0404/150755:ERROR:accelerated_surface_win.cc(208)] Reseting D3D device
[5468:8996:0404/150758:ERROR:textfield.h(156)] NOT IMPLEMENTED
[WARNING:..\..\..\..\flash\platform\pepper\pep_module.cpp(63)] SANDBOXED

None of this impacts the correct functioning of the tests, but as one might imagine the appearance of "ERROR" and "WARNING" might be rather confusing to, for example, parsing rules in Jenkins looking for failures. Sure I can get really fancy with regular expression in the parsing rules, but it would be really nice to turn off this verbose and unnecessary logging on the part of chromedriver.exe. I have seen many mentions of this searching for an answer. No one has come up with a solution. Yes, chromedriver possibly has a "--silent" option, but there seems to be no way to pass that to the executable. Code similar to below is supposed to work, but has zero effect as far as I can see. Any ideas?

profile = Selenium::WebDriver::Chrome::Profile.new
profile['--cant-make-any-switches-work-here-how-about-you'] = true
browser = Watir::Browser.new :chrome, :profile => profile, :switches => %w[--ignore-certificate-errors --disable-extensions --disable-popup-blocking --disable-translate--allow-file-access]
like image 247
Kevin MacDonald Avatar asked Apr 04 '13 22:04

Kevin MacDonald


2 Answers

Here's help for anyone else searching

Find ...selenium\webdriver\chrome\service.rb Path start may differ on your system

And I added "-silent" to the passed parameters .... However, this silenced everything but the error/warning messages.

    def initialize(executable_path, port)
      @uri           = URI.parse "http://#{Platform.localhost}:#{port}"
      server_command = [executable_path, " -silent", "--port=#{port}"]

      @process       = ChildProcess.build(*server_command)
      @socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT

      @process.io.inherit! if $DEBUG == true
    end
like image 76
Paul Denize Avatar answered Sep 29 '22 06:09

Paul Denize


set chromeOptions with key --log-level=3 this should shut it up

like image 29
codeCruncher Avatar answered Sep 29 '22 06:09

codeCruncher