You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PuppeteerSharp在portapps版Brave便携版中无法正常运行

故障表现
  • 全版本官方Brave浏览器均可正常适配,仅portapps制作的修改版Brave™ portable便携版存在运行异常
  • 使用搭配Extrasharp插件的PuppeteerSharp调用该便携版浏览器时,浏览器可正常启动,但无法执行页面导航操作,最终抛出超时错误:PuppeteerSharp.ProcessException: Timed out after 30000 ms while trying to connect to Base!
  • 同环境下使用Selenium调用同版本便携浏览器可正常运行
基础环境信息
  • 运行平台:OB2(Openbullet 2)
  • 操作系统:Windows 10
  • 测试覆盖浏览器版本:Brave 97.XX、Brave 101.XX
浏览器运行日志
D:/a/brave-portable/brave-portable/main.go:109 > Cannot import registry key error="reg file C:\\portapps\\brave-portable\\reg\\Brave-Browser-Development.reg not found" Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:168 > Process: C:\portapps\brave-portable\app\brave.exe Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:169 > Args (config file): Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:170 > Args (cmd line): --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-features=TranslateUI --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain about:blank --disable-notifications --disable-blink-features=AutomationControlled --remote-debugging-port=0 --user-data-dir=C:\Users\pc\AppData\Local\Temp\ov5gvgs3.hsi Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:171 > Args (hardcoded): --user-data-dir=C:\portapps\brave-portable\data --disable-brave-update --no-default-browser-check --disable-logging --disable-breakpad --disable-machine-id --disable-encryption-win Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:172 > Working dir: C:\portapps\brave-portable\app Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:173 > App path: C:\portapps\brave-portable\app Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:174 > Data path: C:\portapps\brave-portable\data Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:175 > Previous path: C:\portapps\brave-portable Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:181 > Launching Brave Fri, 20 May 2022 14:10:52 CEST INF ..\..\..\runneradmin\go\pkg\mod\github.com\portapps\portapps\v3@v3.4.0\portapps.go:191 > Exec C:\portapps\brave-portable\app\brave.exe --disable-background-networking --enable-features=NetworkService,NetworkServiceInProcess --disable-background-timer-throttling --disable-backgrounding-occluded-windows --disable-breakpad --disable-client-side-phishing-detection --disable-component-extensions-with-background-pages --disable-default-apps --disable-dev-shm-usage --disable-features=TranslateUI --disable-hang-monitor --disable-ipc-flooding-protection --disable-popup-blocking --disable-prompt-on-repost --disable-renderer-backgrounding --disable-sync --force-color-profile=srgb --metrics-recording-only --no-first-run --password-store=basic --use-mock-keychain about:blank --disable-notifications --disable-blink-features=AutomationControlled --remote-debugging-port=0 --user-data-dir=C:\Users\pc\AppData\Local\Temp\ov5gvgs3.hsi --user-data-dir=C:\portapps\brave-portable\data --disable-brave-update --no-default-browser-check --disable-logging --disable-breakpad --disable-machine-id --disable-encryption-win
故障根因

从启动日志可以明确问题:

  1. PuppeteerSharp启动浏览器时,会自动传入临时用户目录参数--user-data-dir=C:\Users\pc\AppData\Local\Temp\ov5gvgs3.hsi,并在该目录下写入远程调试相关配置,用于和浏览器建立调试连接
  2. portapps便携版的外层启动器会硬编码追加自己的固定用户目录参数--user-data-dir=C:\portapps\brave-portable\data,最终启动命令中出现了两个重复的--user-data-dir参数
  3. Chromium内核浏览器启动时遇到重复的启动参数,只会读取最后一个传入的参数值,因此浏览器实际使用的是启动器指定的固定用户目录,而非PuppeteerSharp生成的临时目录
  4. PuppeteerSharp在临时目录下找不到浏览器的调试端口信息,无法建立连接,最终触发30秒连接超时。日志中提示的注册表文件缺失属于非关键报错,不会影响浏览器核心功能。
  5. Selenium调用时通过独立的浏览器驱动进程中转通信,不依赖临时用户目录下的调试配置文件,因此不受该参数冲突影响,可以正常运行。
解决方案
  • 优先选择官方发布的正式版Brave浏览器,不存在第三方启动器注入参数的问题,自动化调用兼容性最佳
  • 如果必须使用该便携版本,不要调用外层的便携版启动器,直接将便携版目录下app/brave.exe的真实浏览器主程序路径传入PuppeteerSharp的启动配置,跳过启动器的参数注入逻辑即可恢复正常。

内容的提问来源于stack exchange,提问作者Mohamed Reda Chams

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.03 03:27:26