What is the correct Ruby code for configuring Selenium to access the JavaScript console (i.e., messages writing using console.log
, console.error
, console.info
, etc.)?
I've found several articles with Java, Python, and C# code; but, I'm having trouble getting everything just right for Ruby.
Here is my best guess for Firefox:
caps = Selenium::WebDriver::Remote::Capabilities.chrome
caps[:loggingPref] = {:browser => :all}
return Selenium::WebDriver.for :firefox, :desired_capabilities => caps
This code doesn't appear to affect anything (I get some logging messages, but not those generated by console.log
, console.error
, etc.). Therefore, I suspect I just have something spelled wrong, or a symbol where I need a string.
Chrome to provide access to console.info
, console.error
, and console.warn
messages by default. It does not show console.log
messages. I assume there is a similar technique for configuring the Chrome driver to return all messages; but, again, I can't find just the right combination of keys, values, symbols, and strings to make it work.