使用 Nightwatch 和 Selenium 连接到端口 4445 上的本地主机时出错

Error connecting to localhost on port 4445. with Nightwatch and Selenium

我正在尝试 运行 我的脚本使用 Nightwatch(Javascript),但我收到了这个错误:

      \ Connecting to localhost on port 4445...

     ‼ Error connecting to localhost on port 4445.
      × failed
        Error: An error occurred while retrieving a new session: "session not created: This 
        version 
       of ChromeDriver only supports Chrome version 90"   

      × failed
      Error: Nightwatch client is not ready.
                Looks like function "createSession" did not succeed or was not called yet.
      at Object.globals [as get] (C:\automation-Nightwatcg-12-27\QA Automation 
     \node_modules\nightwatch-api\lib\proxy.js:21:17)
      at World.<anonymous> (C:\automation-Nightwatcg-12-27\QA 
      Automation\/cucumber.conf.js:72:17) 

来自nightwatch.js.conf

    webdriver: {
    start_process: !Boolean(process.env.NIGHTWATCH_SELENIUM_GRID),
    port: process.env.NIGHTWATCH_SELENIUM_PORT || 4445,
   
    }, 

我尝试 运行 ChromeDriver

  Starting ChromeDriver 96.0.4664.45 (76e4c1bb2ab4671b8beba3444e61c0f17584b2fc-refs/branch- 
  heads/4664@{#947}) on port 9515
  Only local connections are allowed.
  Please see https://chromedriver.chromium.org/security-considerations for suggestions on 
  keeping ChromeDriver safe.
  ChromeDriver was started successfully.

所以当 运行ning ChromeDriver 时,我可以看到它 运行ning 在端口 9515 上。 我尝试使用端口 9515 编辑文件 nightwatch.js.conf,但没有成功。

我也做了那些步骤,但没有用 删除您的 package-lock.json 文件和 node_modules 文件夹。然后执行 npm 缓存清理 1-npm 缓存清理 --force 2-npm 安装

我好像有端口冲突 有没有人有想法继续处理这个问题?提前谢谢你

This version of ChromeDriver only supports Chrome version 90

在我看来,这就像是您机器上的 chrome 版本与您正在使用的 chrome 驱动程序版本之间的兼容性问题。也许您需要同时更新它们才能兼容。