5

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]
4

4 回答 4

2

chromeOptions用这个设置key --log-level=3应该关闭它

于 2014-04-28T08:20:00.587 回答
2

这是其他搜索的帮助

查找...selenium\webdriver\chrome\service.rb 路径开始可能在您的系统上有所不同

我在传递的参数中添加了“-silent”……但是,这使除错误/警告消息之外的所有内容都静音了。

    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
于 2013-04-24T03:37:56.863 回答
1

通过使用 :service_log_path 参数,我能够转移数百甚至数百条显示在黄瓜标准输出中的 chrome 驱动程序日志消息。

@browser = Watir::Browser.new :chrome, :service_log_path => 'chromedriver.out'

上面建议的'-silent', or '--silent', or ' -silent'or' --silent'参数在我添加到...selenium\webdriver\chrome\service.rb. 并且不得不调整 gem 本身并不是一个特别可行的解决方案。

我找不到捕获 chromedriver stderr 并将其转移到 null 的地方(更不用说必须在 windows 和 *nix/osx 中处理)

驱动程序应该默认使用不那么冗长的方式。在这种情况下,INFO 过于冗长,因为数百个日志条目会以 INFO 的形式弹出,其中 90% 以上是相同的。

至少 :service_log_path论点在大多数情况下都有效。

于 2013-06-27T19:29:11.437 回答
0

您可以尝试-Dwebdriver.chrome.logfile="/dev/null"和/或-Dwebdriver.chrome.args="--disable-logging"运行 java 的选项selenium-server-standalone-what.ever.jar

于 2014-03-19T04:19:06.977 回答