fix(bridge): support fileChooserAccept in Bridge mode and WSL environments#2693
Open
FE-runner wants to merge 1 commit into
Open
fix(bridge): support fileChooserAccept in Bridge mode and WSL environments#2693FE-runner wants to merge 1 commit into
FE-runner wants to merge 1 commit into
Conversation
…ments - chrome-extension/page.ts: call ensureDebuggerAttached() before Page.setInterceptFileChooserDialog in registerFileChooserListener, fixing -32000 Not allowed error in Bridge mode - agent.ts: convert WSL paths in normalizeFilePaths so Windows Chrome can read files via DOM.setFileInputFiles: /mnt/c/... → C:\... /home/... → \\wsl$\<distro>\...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
关联 issue:#2691
Bridge 模式下使用
fileChooserAccept报错-32000 Not allowed;WSL 环境下路径无法被 Windows Chrome 读取。根本原因
问题一:
registerFileChooserListener在调用Page.setInterceptFileChooserDialog前没有执行ensureDebuggerAttached(),导致 debugger 未 attach 时命令被拒绝。问题二:WSL 环境中,Midscene CLI 使用 Linux 路径(如
/home/user/file.zip),通过DOM.setFileInputFiles传给 Windows Chrome 后,Chrome 无法识别该路径格式,导致文件上传失败。修复内容
packages/web-integration/src/chrome-extension/page.ts在
registerFileChooserListener中,发送 CDP 命令前先调用ensureDebuggerAttached():packages/core/src/agent/agent.ts在
normalizeFilePaths中,检测 WSL 环境(WSL_DISTRO_NAME)并自动转换路径:/mnt/c/path→C:\path(WSL 挂载的 Windows 盘符)/home/user/path→\\wsl$\Ubuntu\home\user\path(WSL 本地路径)测试
在 WSL2 + Windows Chrome Bridge 模式下,使用
fileChooserAccept上传文件测试通过。