Selenium可以在CircleCi环境中按域名访问Web服务器

发布于 2025-02-09 09:48:36 字数 937 浏览 3 评论 0原文

在CircleCi配置中,我将my-Domain添加到etc/hosts按订单中,以通过域名访问本地WebServer。

例如=> http:// my-domain:3000/some-endpoint

,但是当我使用以下config.yml开始硒测试时,我只能调用http://127.0.0.0.0.1:3000/ some-endpointhttp:// localhost:3000/some-endpoint selenium。

当我尝试使用http:// my-domain:3000/some-endpoint selenium时,它给了我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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文