I'm trying to relax Chrome's CSP while running a test using proctractor (webdriver, chromedriver).
So the solution can be either
- a flag like "--disable-csp" which dose not exist according to my search results.
- a setting for webdriver/protractor to do so.
I could not find any solution but to setup a proxy that filters the header.
any ideas?
currently there are no native option but you can disable CSP using extension.
Step:
- Download extension Disable Content-Security-Policy
- Save it as
.zip
, because it need modification to enable "disable CSP" at start
- extract the file or if using Winrar double click file
background.js
to edit
- change
var isCSPDisabled = false;
to true
- save change.
code
chrome_options = Options()
chrome_options.add_extension('path/to/disableCSP.zip') # or disableCSP.xpi
driver = webdriver.Chrome(chrome_options=chrome_options)