user2490003
user2490003

Reputation: 11890

Viewing JavaScript Console Output in Capybara

I'm using capybara (3.9.0) with selenium-webdriver (3.14.1)

Is there an easy way to view the output printed to the browser console with console.log(), console.debug(), etc... ?

This post implies that I can do the following, which errors:

> page.driver.browser.manage.logs.get(:browser)
NoMethodError: undefined method `log' for #<Selenium::WebDriver::Remote::W3C::Bridge:0x00007fa4ae2d8a98>

Thanks!

Upvotes: -1

Views: 919

Answers (1)

Thomas Walpole
Thomas Walpole

Reputation: 49890

You need to be running a recent version of Capybara and selenium-webdriver for that to be available. You will also will need to configure your driver to enable logging in Chrome, otherwise the call will always return empty.

Upvotes: 0

Related Questions