相关疑难解决方法(0)

Puppeteer chrome 允许多个文件下载

我正在尝试抓取一个网站上的多个 pdf 文件。但下载第一个后,chrome 要求我允许该网站下载多个文件。 下载多个文件

我们可以在启动浏览器时允许这样做吗?一旦我手动允许并下载所有文件,这个代码就可以工作。

for(selector of selectors){
   await this.currentPage._client.send('Page.setDownloadBehavior', { behavior: 'allow', downloadPath: downloadFilePath });
   await this.currentPage.waitFor(1000);
   await this.currentPage.evaluate(el => el.click(), selector);
   await this.currentPage.waitFor(1000 * 20);
}
Run Code Online (Sandbox Code Playgroud)

download chromium node.js web-scraping puppeteer

6
推荐指数
1
解决办法
2396
查看次数

标签 统计

chromium ×1

download ×1

node.js ×1

puppeteer ×1

web-scraping ×1