尝试使用 ggr+selenoid 时出错:ECONNREFUSED 127.0.0.1:443

Getting error on attempt to work with ggr+selenoid: ECONNREFUSED 127.0.0.1:443

我自己的 ggr+selenoid 集群 (https://test:123456@selenoid.my.server.com:443/wd/hub/session)。使用 curl 创建会话工作正常。

似乎是 https 问题 - 它尝试连接到 localhost:443,但对我的 ggr url

抛出错误

WebdriverIO 版本:v7 模式:WDIO Testrunner 如果是 WDIO Testrunner,运行 sync/async:同步 Node.js版本:v12.22 NPM 版本:6.14.11

"@wdio/allure-reporter": "^7.5.7",
"@wdio/cli": "^7.5.7",
"@wdio/local-runner": "^7.5.7",
"@wdio/mocha-framework": "^7.5.3",
"@wdio/spec-reporter": "^7.5.7",

  runner: 'local',
  protocol: 'https',
  user: 'test',
  key: '123456',
  hostname: 'ggr.my.server.com',
  port: 443,
  path: '/wd/hub/',

[0-0] 2021-06-18T11:32:49.065Z ERROR webdriver: RequestError: connect ECONNREFUSED 127.0.0.1:443
[0-0]     at ClientRequest.<anonymous> (/Users/.../Documents/project/web-tests-wdio/node_modules/got/dist/source/core/index.js:956:111)
[0-0]     at Object.onceWrapper (node:events:476:26)
[0-0]     at ClientRequest.emit (node:events:381:22)
[0-0]     at ClientRequest.emit (node:domain:470:12)
[0-0]     at ClientRequest.origin.emit (/Users/.../Documents/project/web-tests-wdio/node_modules/@szmarczak/http-timer/dist/source/index.js:39:20)
[0-0]     at TLSSocket.socketErrorListener (node:_http_client:472:9)
[0-0]     at TLSSocket.emit (node:events:369:20)
[0-0]     at TLSSocket.emit (node:domain:470:12)
[0-0]     at emitErrorNT (node:internal/streams/destroy:188:8)
[0-0]     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
[0-0]     at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1138:16)

[0-0] 2021-06-18T11:32:49.065Z ERROR @wdio/runner: Error: Failed to create session.
[0-0] Unable to connect to "https://ggr.my.server.com:443/wd/hub/", make sure browser driver is running on that address.
[0-0] If you use services like chromedriver see initialiseServices logs above or in wdio.log file as the service might had problems to start the driver.
[0-0]     at Object.startWebDriverSession (/Users/.../web-tests-wdio/node_modules/webdriver/build/utils.js:68:15)
[0-0]     at processTicksAndRejections (node:internal/process/task_queues:94:5)
[0-0]     at Function.newSession (/Users/.../web-tests-wdio/node_modules/webdriver/build/index.js:58:45)
[0-0]     at Object.remote (/Users/.../web-tests-wdio/node_modules/webdriverio/build/index.js:67:22)
[0-0]     at Runner._startSession (/Users/.../web-tests-wdio/node_modules/@wdio/runner/build/index.js:216:56)
[0-0]     at Runner._initSession (/Users/.../web-tests-wdio/node_modules/@wdio/runner/build/index.js:172:25)
[0-0]     at Runner.run (/Users/.../web-tests-wdio/node_modules/@wdio/runner/build/index.js:87:19)

好的,对于将来会寻找解决方案的人来说:

在我的项目中有一些深层文件(我们目前处于迁移阶段)

import { browser } from 'protractor'

出于某种原因,一些量角器依赖项或量角器本身改变了 webdriverio 连接到远程 https selenoid 的行为,并给出了我在问题中发布的非常不清楚的错误。

避免使用会改变全局 http/https 模块行为的依赖项。

这个问题指出我应该检查我的依赖项:https://github.com/sindresorhus/got/issues/1572