yes I already do that
const launchContext: PlaywrightLaunchContext = {
launcher: firefox,
launchOptions: {
headless: false,
args: [
'--no-sandbox',
'--disable-setuid-sandbox',
'--disable-dev-shm-usage',
],
},
useChrome: false, // Use Chromium instead of Chrome for better performance
userAgent: userAgents[Math.floor(Math.random() * userAgents.length)],
}
...
launchContext,
preNavigationHooks: [
async ({ page }) => {
await playwrightUtils.blockRequests(page, {
urlPatterns: [
'.png',
'.jpg',
'.jpeg',
'.gif',
'.svg',
'.ico',
'.woff',
'.woff2',
'adsbygoogle.js',
],
extraUrlPatterns: ['adsbygoogle.js'],
})
await playwrightUtils.closeCookieModals(page)
},
],
unfortunetly I recive:
WARN Playwright Utils: blockRequests() helper is incompatible with non-Chromium browsers.
I didn't know that 😄