Silencing Chrome driver console outputs when I run my tests

江枫思渺然 提交于 2019-12-08 20:02:04

问题


I am using latest versions of Chrome(32.0.1700.107) and Chrome driver(V2.8). But when I run my sample test with following code in Ruby:

    require 'selenium-webdriver'
    WAIT = Selenium::WebDriver::Wait.new(timeout: 100)
    $driver = Selenium::WebDriver.for :chrome
    $driver.manage.window.maximize
    $driver.navigate.to 'https://www.google.co.in'

     def apps_hover
      ele_hover = $driver.find_element(:xpath, ".//*[@id='gbwa']/div[1]/a")
      $driver.action.move_to(ele_hover).perform
      sleep 5
      puts"Pass"
     end

     apps_hover
    $driver.quit()

I get the console output from chrome driver at the beginning like following :

[5032:4816:0218/130016:ERROR:chrome_views_delegate.cc(176)] NOT IMPLEMENTED [5032:4816:0218/130016:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED [5032:4816:0218/130016:ERROR:desktop_root_window_host_win.cc(746)] NOT IMPLEMENTED.

Is there a way to silence these console outputs?


回答1:


I haven't found a way to silence chrome driver warnings directly. You can however write a filter script fairly easily which processes each line of output and excludes these lines from STDOUT or STDERR (depending on which way they are being sent).

Related: Best practices in dealing with STDIN in ruby



来源:https://stackoverflow.com/questions/21847140/silencing-chrome-driver-console-outputs-when-i-run-my-tests

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!