【问题标题】:Error with latest Chrome v74 and selenium-chromedriver Host header or origin header is specified and is not localhost最新的 Chrome v74 和 selenium-chromedriver 出现错误 指定了主机标头或源标头并且不是 localhost
【发布时间】:2019-04-26 09:21:33
【问题描述】:

我正在使用 selenium 独立 4.0.0 和 chromedriver 74 运行量角器 6.0.0。当我下载 2 天前发布的 Chrome (v74) 的最新更新时,一切都崩溃了。现在,每当我尝试运行测试时,都会收到以下错误:

Error: WebDriverError: Host header or origin header is specified and is not localhost.

这是从哪里来的?我在 localhost 上运行一切。

以下是启动量角器时下载的文件:

curl -o /Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/webdriver-manager/downloads/chromedriver.xml https://chromedriver.storage.googleapis.com/
curl -o /Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/webdriver-manager/downloads/selenium-server.xml https://selenium-release.storage.googleapis.com/
curl -o /Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/webdriver-manager/downloads/chromedriver_mac64.zip https://chromedriver.storage.googleapis.com/74.0.3729.6/chromedriver_mac64.zip
curl -o /Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/webdriver-manager/downloads/selenium-server-standalone-4.0.0-alpha-1.jar https://selenium-release.storage.googleapis.com/4.0/selenium-server-standalone-4.0.0-alpha-1.jar

我得到的全栈错误

[14:27:12] I/local - Starting selenium standalone server...
[14:27:15] I/local - Selenium standalone server started at http://10.190.111.145:4444/wd/hub
[14:27:19] E/launcher - Error: WebDriverError: Host header or origin header is specified and is not localhost.
    at parseHttpResponse (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:559:11)
    at Executor.execute (/Users/biberli/.nvm/v8.11.3/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/http.js:468:26)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
[14:27:19] E/launcher - Process exited with error code 100

【问题讨论】:

    标签: selenium-webdriver protractor selenium-chromedriver


    【解决方案1】:

    好的,我终于想通了:您可以为 selenium 独立使用“环回”选项。在protractor.conf 中,使用:

    exports.config = {
        (...)
        localSeleniumStandaloneOpts: {
            loopback: true
        }
    }
    

    编辑:对于那些不使用量角器的人,here is a link to the relevant option in selenium-webdriver

    【讨论】:

      猜你喜欢
      • 2019-09-28
      • 2021-04-29
      • 2012-11-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-22
      • 2016-11-05
      • 2017-03-07
      相关资源
      最近更新 更多