Get console log history through Ruby WebDriver

This question was previously addressed in Java ( Get the Chrome Console Log )

However, I use Ruby bindings and wondered if they provided similar functionality?

I have looked at the source code of Ruby, but I do not see references or links to LoggingPreferences.

By the way, I use RemoteWebDriver and pass the desired feature object. Presumably, I want to set the logging options in this object, but I'm struggling to see where.

+7
ruby selenium-webdriver webdriver selenium-chromedriver
source share
1 answer

Apologies for the late reply.

I initially achieved this by adding the following to Webdriver:

module Selenium module WebDriver class Options # # Returns the available logs for this webDriver instance # def available_log_types @bridge.getAvailableLogTypes end # # Returns the requested log # # @param type [String] The required log type # # @return [Array] An array of log entries # def get_log(type) @bridge.getLog(type) end end end end 

When "required", this led to the following being supported:

 driver.manage.get_log(:browser) 

However, version 2.38 of the selenium ore gem reveals a logging API (albeit experimental).

http://selenium.googlecode.com/git/rb/CHANGES

https://code.google.com/p/selenium/wiki/Logging

Therefore, starting from 2.38, the following should work WITHOUT the above extension;

 driver.manage.logs.get :browser 
+6
source share

All Articles