Call to eval() blocked by CSP with Selenium IDE

前端 未结 1 498
失恋的感觉
失恋的感觉 2021-01-22 11:41

I have a selenium test developed in Selenium IDE. I have a step in this suite that should type a value in a text field. It fails at that step giving the following e

相关标签:
1条回答
  • 2021-01-22 11:57

    CSP

    Content Security Policy (CSP) acts as a added layer of security that helps to detect and mitigate attacks including Cross Site Scripting (XSS) and data injection attacks. These attacks are primarily used for data theft and distribution of malware.


    This error message...

    call to eval() blocked by CSP
    

    ...implies that the add-on which is being used by the Selenium IDE doesn't include 'unsafe-eval' in CSP header.

    As per the discussion Firefox add-on needs 'unsafe-eval' in CSP header the earlier version of Firefox were not able to detect Ember.js based application if the server sends the Content Security Policy header without 'unsafe-eval' in the script-src directive.

    This issue was discussed at length within the discussion Convert Firefox add-on to use the Chrome WebExtension and was addressed through a installable WebExtension which can be found here.


    Update

    As per OP's comment an easier approach would be to tweak the following Key-Value within about:config which solves the issue:

    security.csp.enable    off
    

    Reference

    You can find a relevant discussion in Refused to load the script because it violates the following Content Security Policy directive: script-src error with ChromeDriver Chrome and Selenium

    0 讨论(0)
提交回复
热议问题