Answer a question

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 error:

18. click on id=firstName Failed:11:12:59
call to eval() blocked by CSP

enter image description here

Answers

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

Logo

学AI,认准AI Studio!GPU算力,限时免费领,邀请好友解锁更多惊喜福利 >>>

更多推荐