Closed pxCaptcha closed 3 years ago
Same problem here
The problem is that this is conflicting with the navigator.permissions
evasion. To fix this, disable the evasion. Sample:
const pluginStealth = require('puppeteer-extra-plugin-stealth')()
pluginStealth.enabledEvasions.delete('navigator.permissions')
puppeteer.use(pluginStealth)
Theoretically the code should only affect e.g. await navigator.permissions.query({name:'notifications'})
We can also check if there's a better way to spoof this by using CDP methods, instead of JS patching.
There's Browser.setPermission()
, but I'm not sure if/how that works in headless.
navigator.permissions
has been rewritten (#429) in puppeteer-extra-plugin-stealth@2.7.5
, kindly test if this is still an issue (closing for now).
When I use overridePermissions my code is working in normal puppeteer or in puppeteer-extra without StealthPlugin() without any problem, but as soon as you add the StealthPlugin() its just not overriding anymore..
const context = browser.defaultBrowserContext();
context.overridePermissions("https://www.zalando.de/", ["geolocation", "notifications", "push", "midi", "camera", "microphone", "speaker", "device-info", "background-sync", "bluetooth", "persistent-storage", "ambient-light-sensor", "accelerometer", "gyroscope", "magnetometer", "clipboard", "accessibility-events", "clipboard-read", "clipboard-write", "payment-handler"]);