Skip to content

Instantly share code, notes, and snippets.

@strika
Created February 26, 2016 13:56
Show Gist options
  • Save strika/96a07d4cf23af849961f to your computer and use it in GitHub Desktop.
Save strika/96a07d4cf23af849961f to your computer and use it in GitHub Desktop.
Print browser logs in selenium-webdriver
def print_browser_logs
logs = page.driver.browser.manage.logs.get(:browser).map { |line| [line.level, line.message] }
logs.reject! { |line| ["WARNING", "INFO"].include?(line.first) }
puts "========== BROWSER LOGS =========="
logs.each do |line|
puts line.join(" - ")
end
puts "=================================="
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment