且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Azure云服务或Azure Functions中运行Headless Chrome?

更新时间:2023-02-08 23:41:42

我建议使用 https://www.browserless.io/,因此您无需在应用程序服务中运行chrome.exe.

I would recommend to use https://www.browserless.io/ so you don't have to run the chrome.exe in the app service.

用puppeteer.connect替换puppeteer.launch

Replace puppeteer.launch with puppeteer.connect

const browser = await puppeteer.connect({
  browserWSEndpoint: 'wss://chrome.browserless.io/'
});