首页 > 解决方案 > Protractor Visual Studio 代码调试错误无法连接到运行时进程,10000 秒后超时

问题描述

Protractor Visual Studio Code Debug Error 无法连接到运行时进程,10000 秒后超时 - (原因:无法连接到目标:连接 ECONNREFUSED 127.0.0.1:36406)。

下面是我的launch.json文件配置

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [        
        {            
            "type": "node",
            "request": "launch",
            "name": "Launch via npm",            
            "cwd": "${workspaceRoot}",
            "runtimeExecutable": "npm.cmd",
            "runtimeArgs": [
                "run-script", "regression_sat",
                "--inspect=5858"
            ]
        },
        {
            "type": "node",
            "request": "attach",
            "name": "Attach to Process",
            "port": 5858
        }
    ]
}

下面是带有脚本标签的 package.json 文件

"scripts": {
    "webdriver-start": "npm_webdriver.bat",
    "protractor": "protractor_batch.bat"
    "regression_sat": "node_modules/.bin/protractor.cmd ./config/protractor.chrome.conf.js --suite suite_sat --params.env sat"
  }

标签: debuggingvisual-studio-codeprotractor

解决方案


导致此错误的最可能原因是调试会话终止时 Visual Studio 启动的浏览器窗口仍在运行。这会阻止下一个调试会话成功启动。

完成调试会话后,关闭浏览器窗口本身,而不是运行应用程序的选项卡。这将确保下一个调试会话可以启动浏览器的新实例进行调试。


推荐阅读