title: Run Selenium tests for Django project in Gitlab CI : ERR_CONNECTION_REFUSED on get live_server_url
body: <p>I'm trying to have GitLab CI run (with a shared runner) Selenium tests on my Django project every time commits are pushed to the repo on Gitlab.com.</p>
  <p>gitlab-ci.yml:</p>
  <pre><code>image: python:3.8.5
  
  services:
    - selenium/standalone-chrome:latest
  
  cache:
    paths:
      - ~/.cache/pip/
  
  before_script:
    - python -V
    - python -m pip install --force-reinstall pip==18.1
    - pip install -r requirements.txt
  
  test:
    script:
      - python manage.py test
  </code></pre>
  <p>tests.py:</p>
  <pre><code>from django.test import TestCase
  from django.test import LiveServerTestCase
  from selenium import webdriver
  from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
  
  @override_settings(DEBUG=True)
  class CreateNewProjectTestCase(LiveServerTestCase):
  
      def setUp(self):
          selenium_url = 'http://selenium__standalone-chrome:4444/wd/hub'
          self.selenium = webdriver.Remote(
              command_executor=selenium_url,
              desired_capabilities=DesiredCapabilities.CHROME)
          super(CreateNewProjectTestCase, self).setUp()
  
      def test_create(self):
          selenium = self.selenium
          selenium.get(self.live_server_url)
  </code></pre>
  <p>However, when the pipeline job executes, I get the following error (connection refused) on <code>selenium.get(self.live_server_url)</code>, resulting in a job's failure:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;/builds/uchem/projectmanagment-django-heroku/projects/tests.py&quot;, line 54, in test_create
      selenium.get(self.live_server_url)
    File &quot;/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 333, in get
      self.execute(Command.GET, {'url': url})
    File &quot;/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py&quot;, line 321, in execute
      self.error_handler.check_response(response)
    File &quot;/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py&quot;, line 242, in check_response
      raise exception_class(message, screen, stacktrace)
  selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_CONNECTION_REFUSED
    (Session info: chrome=86.0.4240.75)
  </code></pre>
  <p>Is there something I am missing? I think the URL is correct and I saw answers quite similar to this.</p>
  <p>This question is similar to <a href="https://stackoverflow.com/questions/50601185/django-connection-refused-to-live-server-url">this one</a>, but not exactly because the gitlab-ci.yaml is different yet.</p>