How to run selenium in Gitlab CI for django app

Hi friends! I am trying to setup my gitlab-ci so it runs my selenium tests and I am struggling with it. I am running a django app. Locally I get my selenium tests to work but not in my CI.

This is the simple test I am using for starters:

class SeleniumTest(TestCase):
  def test_visit_site_with_chrome(self):
      driver = webdriver.Remote(
          command_executor='http://selenium_hub:4444/wd/hub',
          desired_capabilities=DesiredCapabilities.CHROME
      )
      driver.get('http://django:8000')
      self.assertIn(driver.title, 'mywebsite')

      driver.quit()

And here is my CI:

image: docker:19.03.0

variables:
  selenium_remote_url: "http://gitlab-selenium-server:4444/wd/hub"

services:
  - docker:19.03.0-dind
  - selenium/standalone-chrome:latest

tests-website:
  stage: unittests
  before_script:
    - apk update
    - apk upgrade
    - apk add python python-dev py-pip build-base libffi-dev openssl-dev libgcc
    - pip install docker-compose
  script:
    - docker-compose -f local.yml build
    - docker-compose -f local.yml run django pytest system-tests/
  tags:
    - docker

My main problem is that I do not know how to set the URLs correctly in the CI and as command executor. Also I get this error

urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host=‘gitlab-selenium-server’, port=4444): Max retries exceeded with url: /wd/hub/session (Caused by NewConnectionError(‘: Failed to establish a new connection: [Errno -2] Name does not resolve’,))

I also tried passing ----host=selenium__standalone-chrome to the pytest directive but without success. I get an unrecognized arguments error

Help is greatly appreciated. Thanks very much in advance

no idea anyone?

self.driver = webdriver.Remote(
command_executor=“http://selenium__standalone-chrome:4444/wd/hub”,
desired_capabilities=DesiredCapabilities.CHROME
)