Selenium can't access web server by domain name in CircleCI environment

99 views Asked by At

In CircleCi config, I added my-domain to etc/hosts in-order to access local webserver by domain name.

For example => http://my-domain:3000/some-endpoint

But when I start Selenium-testing using the following config.yml, I can only call http://127.0.0.1:3000/some-endpoint and http://localhost:3000/some-endpoint from Selenium.

When I try to use http://my-domain:3000/some-endpoint from the Selenium, it gave me org.openqa.selenium.NoSuchElementException

steps:
      - checkout
      - run:
          name: Add my-domain in etc/hosts
          command: |
            echo '127.0.0.1 my-domain' | sudo tee -a /etc/hosts
            cat /etc/hosts
      - run:
          name: Start server for testing
          command: |
            cd ${DIR}
            . venv/bin/activate
            python3 server.py
          background: true
      - run:
          name: Start Testing
          command: ./gradlew test --stacktrace
0

There are 0 answers