Posted almost 3 years ago. Visible to the public.

How to enable Chromedriver logging

When using Chrome for Selenium tests, the chromedriver binary will be used to control Chrome. To debug problems that stem from Selenium's Chrome and/or Chromedriver, you might want to enable logging for the chromedriver itself. Here is how.

Option 1: Use Selenium::WebDriver::Service

In your test setup, you may already have something like, browser: :chrome, options: ...), especially when passing options like device emulation.

Similar to options, simply add an extra key service and pass an instance of Selenium::WebDriver::Service like so:

service = { verbose: true, log_path: '/tmp/chromedriver.log' }), browser: :chrome, options: ..., service: service)

Note that version 3.x also supports passing the service arguments as driver_opts directly. However, this is deprecated and will be removed in version 4 of selenium-webdriver.

Option 2: Connect tests to a manually started chromedriver

If the above approach no longer works, or if you want to go bare metal, you can also start chromedriver yourself in a terminal on a custom port:

chromedriver --port=12345 --verbose --log-path=/tmp/chromedriver.log

Then configure Selenium to connect to that port. Like in option 1, you need to pass an extra key when creating your driver instance.

Copy, browser: :chrome, options: ..., url: 'http://localhost:12345')

Note that you may omit the --log-path option to make chromedriver print to your terminal.

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for unsupported versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2).

Owner of this card:

Arne Hartherz
Last edit:
almost 3 years ago
by Arne Hartherz
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Arne Hartherz to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more