Tencent / Tencent/BrowserSkill
Downloads triggered via new tabs or about:blank are not supported | 尚未支持新标签页或 about:blank 触发的文件下载
Open
enhancement
- Dominant language
- TypeScript
- Stars
- 5.7k
- Forks
- 399
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 74
Description
问题描述
BrowserSkill 接管页面后,如果页面上的下载按钮是一个链接,并通过新标签页触发下载,Agent 点击后可能只打开一个 about:blank 空白页,文件无法保存到 bsk download --out 指定的本地路径。
常见页面实现包括:
<a target="_blank" href="...">下载</a>- 点击后调用
window.open("about:blank") - 先打开空白页,再异步获取下载地址
- 下载请求最终发生在新建 tab,而不是原点击页
当前表现
- Agent 在原页面找到下载链接。
- 执行普通点击或
bsk download。 - 浏览器创建一个
about:blank新标签页。 - BrowserSkill 没有捕获或认领该下载。
- 新标签页停留在空白页。
- 使用
bsk download时,命令可能最终超时并返回download_capture_failed;文件也可能进入浏览器默认下载目录,而不是--out指定路径。
期望表现
执行:
bsk download @e3 --out ./result.zip --session <id>
即使下载由新标签页、target="_blank" 或 window.open() 触发,也应当:
- 正确识别新标签页与原点击操作之间的关系
- 捕获新 target 发出的下载事件
- 将下载文件写入 --out 指定路径
- 下载完成后清理无用的 about:blank 标签页
- 不认领其他页面或用户同时发起的无关下载
初步原因分析
当前下载捕获只接受与原点击目标完全一致的 CDP target,并在监听下载事件时进行严格过滤。当链接通过新 tab 发起下载时:
- Page.downloadWillBegin 可能来自新的 tabId / CDP target
- 新建 tab 不满足 sameTarget
- 下载 intent 被忽略
- chrome.downloads 候选无法与点击操作完成关联
- 最终下载捕获超时
此外,当前 Target.setAutoAttach 仅配置了 iframe target,没有覆盖新创建的 page/popup target。Agent Window 中新出现的 tab 也只更新 overlay,没有自动归属当前下载事务。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.