Selenium Can';t为Webdriver.io使用/etc/hosts中映射的URL

Selenium Can';t为Webdriver.io使用/etc/hosts中映射的URL,selenium,selenium-webdriver,webdriver,webdriver-io,Selenium,Selenium Webdriver,Webdriver,Webdriver Io,我正在使用webdriver进行集成测试。我想为url运行测试套件: https://test.url.net 但是我有一些我无法控制的限制 我需要在本地环境上运行测试 我无法使用localhost作为我的url 我通过在/etc/hosts/中添加一个条目将localhost映射到我的url来解决这个问题 $ cat /etc/hosts 127.0.0.1 test.url.net 当我运行webdriver targetinghttps://test.url.net但是,当我尝试瞄准ht

我正在使用webdriver进行集成测试。我想为url运行测试套件:
https://test.url.net
但是我有一些我无法控制的限制

  • 我需要在本地环境上运行测试
  • 无法使用localhost作为我的url
  • 我通过在
    /etc/hosts/
    中添加一个条目将localhost映射到我的url来解决这个问题

    $ cat /etc/hosts
    127.0.0.1 test.url.net
    
    当我运行webdriver targeting
    https://test.url.net
    但是,当我尝试瞄准
    https://localhost:443/
    测试将打开(由于无法将localhost用作域的限制而失败)

    有没有办法为webdriver提供url到ip地址的映射?

    仅针对127.0.0.1/localhost。但是你必须提到港口号码

    试试
    https://test.url.net:443
    手动进入浏览器并检查网站是否加载


    如果是,则将此url与webdriver.io中的端口号一起使用

    是否确实无法使用webdriverio使用所述的相应端口测试本地主机?我记得我做这件事是出于某种原因。