There is no option when using Selenium like the capybara_webkit
debug option that outputs the debug info in realtime, however you can get access to the Chrome
logs and output those at the end of each test (or you could write a helper to output them whenever you call it of course).
First you'd need to configure your selenium driver for logging
Capybara.register_driver :logging_chrome do |app|
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
# customize this based on which and what level logs your prefer
loggingPrefs: {
browser: 'ALL',
driver: 'ALL',
performance: 'ALL'
}
)
browser_options = ::Selenium::WebDriver::Chrome::Options.new()
browser_options.headless!
Capybara::Selenium::Driver.new(
app,
browser: :chrome,
desired_capabilities: caps,
options: browser_options
)
end
Then you'd set up to use that driver
Capybara.javascript_driver = :logging_chrome # possibly default_driver = depending on your config
and then add an after block that gets the logs and displays them
after(:each) do
# customize based on which type of logs you want displayed
log_types = page.driver.browser.manage.logs.available_types
log_types.each do |t|
puts t.to_s + ": " + page.driver.browser.manage.logs.get(t).join("\n")
end
end