google-chrome - Puppeteer save file downloaded from background_page
问题描述
I am using Puppeteer to click a button on page, after that it auto opens a pop up and auto download file.
How to capture that file? I want to save it on server by headless mode.
解决方案
您可以尝试以下方法
await page._client.send('Page.setDownloadBehavior', {behavior: 'allow', downloadPath: '/home/me/stuff'});
该文件将存储在该目录中,因此您可以稍后检查它。
推荐阅读
- r - 自制功能在测试中有效,但不适用于我的实际数据集
- r - 在使用 expand.grid 计算距离矩阵之前按变量对数据集进行子集
- python - Python 密码拒绝验证
- tensorflow - 如何解决回归模型中张量流中的非损失问题
- oracle - Oracle - 需要使用 CONTAINS 来查找包含句点的字符串
- excel - VBA 从 Excel 工作簿和 .sql 文件写入动态查询
- javascript - 文本锚不会出现在 D3 中
- wcf - WCF、MSMQ 和 2 个队列上的独立事务
- sql-server - SQL Server 的并排行
- msbuild - 哪个 MSBuild 目标从项目引用中复制 .dll?