twalpole / apparition

Capybara driver for Chrome using CDP
MIT License
363 stars 46 forks source link

Can't connect to remote Chrome by name #84

Open arbythree opened 3 years ago

arbythree commented 3 years ago

Hi! I'm trying to run rspecs via Docker and not able to connect by name as expected.

docker-compose:

services:

  -- snip --

  chrome:
    image: alpeware/chrome-headless-stable
    ports:
      - "9222:9222"

spec_helper:

require 'capybara/apparition'

Capybara.register_driver :apparition do |app|
  browser_options = { 'remote-debugging-address' => 'chrome', 'remote-debugging-port' => 9222 }
  Capybara::Apparition::Driver.new(app, remote: true, browser_options: browser_options)
end
Capybara.javascript_driver = :apparition

-- snip --

Error observed:

JSON::ParserError:
            809: unexpected token at 'Host header is specified and is not an IP address or localhost.'

I suspect it's something simple. Any ideas? Many thanks!