Getting Selenium::WebDriver::Error::UnknownError: with capybara tests (rails)

I am getting

Selenium::WebDriver::Error::UnknownError:
unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn’t exist)

when trying to launch capybara tests with rails 5.1.7.

Hello,

From a comment on this stackoverflow: this can be caused by using a Chromedriver which does not support the version of the installed Chrome.

Which is a common problem people run into. If you can share a job link here or in a DM I can take a closer look. But a good first step would be to ssh into the job and verify that the installed software versions are those that you expect them to be.

Sure, how could I share a job link? (What does that exactly refer to?)

My config is:

version: 2.1

orbs:
  ruby: circleci/ruby@1.1.0
  node: circleci/node@2
  browser-tools: circleci/browser-tools@1.1.0

jobs:
  build:
    docker:
      - image: circleci/ruby:2.6-stretch-node-browsers-legacy
      - image: redis@sha256:54057dd7e125ca41afe526a877e8bd35ec2cdd33b9217e022ed37bdcf7d09673
      - image: redis:6.0
    steps:
      - checkout
      - ruby/install-deps
      # Store bundle cache
      - node/install-packages:
          pkg-manager: yarn
          cache-key: "yarn.lock"
  test:
    parallelism: 1
    docker:
      - image: cimg/ruby:2.7-node
      - image: circleci/postgres:9.5-alpine
        environment:
          POSTGRES_USER: user
          POSTGRES_DB: Foggle
          POSTGRES_PASSWORD: ""
      - image: redis
      - image: selenium/standalone-chrome
    environment:
      BUNDLE_JOBS: "3"
      BUNDLE_RETRY: "3"
      PGHOST: 127.0.0.1
      PGUSER: user
      PGPASSWORD: ""
      RAILS_ENV: test
    steps:
      - checkout
      - ruby/install-deps
      - node/install-packages:
          pkg-manager: yarn
          cache-key: "yarn.lock"
      - run:
          name: Wait for DB
          command: dockerize -wait tcp://localhost:5432 -timeout 1m
      - run:
          name: Database setup
          command: bundle exec rails db:schema:load --trace
      - run:
          name: Wait for Redis
          command: dockerize -wait tcp://localhost:6379 -timeout 2m

      # Run rspec in parallel
      - ruby/rspec-test
      - ruby/rubocop-check

workflows:
  version: 2
  build_and_test:
    jobs:
      - build
      - test:
          requires:
            - build

after adding this file in my test folder:

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
    driven_by :headless_chrome
end

Now the error changed to:

 Webdrivers::BrowserNotFound:
   Failed to find Chrome binary.

I had the same issue. I fixed it by installing chrome in the job :

      - run: 
          name: Setup Chrome
          command: |
            wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
            sudo apt install ./google-chrome-stable_current_amd64.deb

If this could help anybody :slight_smile:

1 Like