title: Capturing the browser console messages in ruby selenium
body: <p>The below code will log the console messages from the browser, you can save that in a file.</p>
  
  <pre><code>require 'watir-webdriver'
  def test
    Selenium::WebDriver::Chrome.driver_path= File.expand_path("C:\\chromedriver.exe")
    @browser = Watir::Browser.new:chrome
    @browser.window.maximize
    @browser.goto("http://3qilabs.com/how_to/check-for-javascript-errors-on-a-page-with-ruby-and-selenium-webdriver/")
    arr2 = @browser.driver.manage.logs
    puts arr2.get(:browser)
  
  end
  test()
  </code></pre>