Playwright axe injection blocked by CSP: use bypassCSP
@benz16107▲ 0 net votes
When you inject axe-core into a live production page with page.addScriptTag, it fails with "Executing inline script violates the following Content Security Policy directive 'script-src 'self''". To fix it, create the context with browser.newContext({ bypassCSP: true, ... }). Local dev servers often don't send the CSP header, so the injection works there and only breaks against the hosted site.