Search code examples
ruby-on-railsselenium-webdriverselenium-chromedrivercapybara

Capybara, Rails, Selenium, Chromedriver + ERR:CONNECTION_REFUSED


I'm setting up Capybara with Selenium Webdriver in my Rails application, and I keep running into the following error:

Helpdesk Ticketing System assigning a ticket should mark ticket as assigned
     Failure/Error: visit tickets_path
     
     Selenium::WebDriver::Error::UnknownError:
       unknown error: net::ERR_CONNECTION_REFUSED
         (Session info: chrome=85.0.4183.102)

My settings are as follows:

Capybara.server = :puma
Capybara.app_host = 'http://intranet.lvh.me'
Capybara.default_driver = :selenium_chrome_headless

In the logs it shows this before the failure, choosing a different port each time it runs:

Capybara starting Puma...
* Version 4.3.6 , codename: Mysterious Traveller
* Min threads: 0, max threads: 4
* Listening on tcp://127.0.0.1:56277

Anyone help?


Solution

  • I solved my problem. I was missing:

    Capybara.always_include_port = true