A very handy API I’ve stumbled across today:


This returns an array of Selenium::LogEntry instances which have the expected properties - level, timestamp, and message. You can use standard Enumerable methods to filter the log entries down to the information relevant to you.

For example, all error messages:

page.driver.browser.manage.logs.get(:browser).select { |le| le.level == "SEVERE" }.map(&:message)
=> [" - Failed to load resource: net::ERR_CONNECTION_REFUSED", ...]