How to debug and fix chromedriver and selenium errors

Tagged capybara, chromedriver, connection, refused, selenium  Languages bash

You an enable the chromedriver log to debug and fix chromedriver and Selenium errors such as “unknown error: net::ERR_CONNECTION_REFUSED”.

First start the chromedriver in the background:

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

Then configure Selenium to use the chromedriver instance:, browser: :chrome, options: ..., url: 'http://localhost:12345')

Next run the tests and inspect the chromedriver log.

In my case the issue was that an unreachable URL, see the unreachableUrl property in the output below:

[1659101781.048][DEBUG]: DevTools WebSocket Event: Page.frameNavigated B30A4B9FE0908FDACE0522341267520A {
   "frame": {
      "adFrameStatus": {
         "adFrameType": "none"
      "crossOriginIsolatedContextType": "NotIsolated",
      "domainAndRegistry": "",
      "gatedAPIFeatures": [  ],
      "id": "B30A4B9FE0908FDACE0522341267520A",
      "loaderId": "595BC7FEFD2C1ECCE31157FF7972F889",
      "mimeType": "text/html",
      "secureContextType": "InsecureScheme",
      "securityOrigin": "://",
      "unreachableUrl": "http://localhost:3030/",
      "url": "chrome-error://chromewebdata/"
   "type": "Navigation"