Puppeteer + Playwright

This commit is contained in:
2024-05-29 16:42:52 +02:00
parent fe9a8e2b20
commit d38817f4c5
22 changed files with 1913 additions and 284 deletions
+12
View File
@@ -0,0 +1,12 @@
module.exports = (chromium) => {
return async (req, res, next) => {
const browser = await chromium.launch({
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu', '--disable-dev-shm-usage'],
headless: true
});
req.playwrightBrowser = browser;
next();
}
}
+2 -2
View File
@@ -5,10 +5,10 @@ module.exports = (puppeteer) => {
executablePath: '/usr/bin/google-chrome',
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'],
ignoreDefaultArgs: ['--disable-extensions'],
headless: 'new'
headless: 'true'
});
req.browser = browser;
req.puppeteerBrowser = browser;
next();
}
}