google-chrome - VS Code 和 Chrome 调试扩展 - 打开 Chrome 的新实例?

标签 google-chrome visual-studio-code

使用 VS Code 和 Chrome debugging extension如果尚不存在,则启动将打开一个新的 Chrome 实例,或者如果存在,则打开一个新选项卡(但实际上不会工作,因为调试端口未打开)。关闭后,它会关闭所有选项卡。

如果我打开了我想保持打开状态的页面(例如文档),那么这就是真正的 PITA。

有没有一种方法可以让它始终打开自己的 Chrome 实例,即使一个实例已经打开,并且在终止时仅关闭该实例?

即打开自己的 Chrome 实例并保留现有实例。

最佳答案

如果您在 launch.json 中指定 userDataDir,它将为您启动一个新的 Chrome 实例。除非您指定 runtimeArgsruntimeExecutable,否则它还会在第一次启动后每次启动时提供“恢复页面”,这有点无济于事。这是一个示例 launch.json:

"configurations": [
    {
        "name": "Launch localhost",
        "type": "chrome",
        "request": "launch",
        "url": "http://localhost:3000",
        "webRoot": "${workspaceRoot}",
        "sourceMaps": true,
        "sourceMapPathOverrides": {
            "webpack:///src/*": "${webRoot}/*"
        },
        "userDataDir": "${workspaceRoot}.vscode/chrome",
        "runtimeArgs": [
            "--disable-infobars --disable-session-crashed-bubble"
        ],
        "runtimeExecutable": "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"
    }
]

关于google-chrome - VS Code 和 Chrome 调试扩展 - 打开 Chrome 的新实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38573789/

相关文章:

html - 除非打开开发人员工具窗口,否则 <video> 不会在 Chrome 中播放

google-chrome - 使用假网络摄像头和真正的 micro 运行 Chromium

javascript - 输入类型 "date"不可编辑

java - vscode+java+windows : I want to import and use org. apache.logging.log4j.Logger 没有 Maven

c++ - Visual Studio代码: How to configure includePath for better IntelliSense results

visual-studio-code - 是否可以自动缩进Visual Studio Code上的当前行?

visual-studio - Visual Studio 代码对 html 的包装太多

html - Chrome 上的边距格式不正确?

azure - 从 VS Code 部署 Azure 函数 - 成功但在门户中不可见

google-chrome - 在 DevTools 的性能选项卡中分析鼠标单击