CSP error when using assert command in Firefox
@julienb81 commented on Mon Sep 03 2018
Command assert does not work any more with variable in the target. It works with the previous version 3.2.5. The variable value is considered undefined.
Meta -
OS: Windows 7 Selenium Version: IDE 3.3.1 Browser: Firefox 62.0.1 and Chrome 68
Yes, seems also to be related to #380 . Looks like the way Numbers are processed and/or stored differs between 3.2x and 3.3.x
Can you share the assert that you've written?
I doesn't work with the Selenium IDE either, so the problem might be introduced to side-runner from this Direction. Last week, before 3.3.x, I'm sure it was possible to have something going like
| store | 42 | myVar |
| assert | ${myVar} | 42 |
which yields right in the IDE Console (Selenium IDE, Firefox 61.0.1 (64-Bit) Ubuntu)
assert on ${myVar} with value 42... Failed:
call to eval() blocked by CSP
We updated the usage of assert and verify in 3.3.1 so you have to specify the variable name without interpolation brackets (e.g., ${}). This difference could have been made more clear in the reference docs. Apologies for the confusion. Glad to know y'all are using it!
@M3ssman do you get a CSP error when using |assert | myVar | 42 |?
With the 3.3.1 version, | assert | myVar1 | myVar2 | doesn't work. In 3.2.5 version, | assert | ${myVar1} | ${myVar2} | works. The error message is : Failed: Actual value '145.00' did not match 'myVar2'
@tourdedave
I did the Test (see above) right now, Selenium IDE 3.3.1.
In chromium (68.0.3440.106 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)) it says
assert on ${n} with value 42... Failed:
Actual value 'undefined' did not match '42'
and Firefox (Ubuntu 16.04 LTS, 61.0.1 (64-bit)) yields that CSP-thing
assert on ${n} == 42... Failed:
call to eval() blocked by CSP
@M3ssman not | assert | ${n} | 42 | but | assert | n | 42 | (it's different than the example you provided above). Please try that and let me know if you still get CSP errors.
@julienb81 Try | assert | myVar1 | ${myVar2} |
@tourdedave Thanks, it works
@tourdedave
using
store | 42 | n
assert | n | 42
in Firefox (61.0.1 (64-Bit) Mozilla Firefox for Ubuntu) still gives
1.store on 42 with value n... OK
2.assert on n with value 42... Failed:
call to eval() blocked by CSP
and Chromium-Browser ( 68.0.3440.106 (Offizieller Build) Built on Ubuntu , running on Ubuntu 16.04 (64-Bit))
1.store on 42 with value n... OK
2.assert on n with value 42... OK
so Chromium Ubuntu succeeds, Firefox Ubuntu still fails.
After some recherches there seems to be quite an old Issue: firefox-os-privileged-app-error-call-to-eval-blocked-by-csp-at-jquery
FWIW, I ran into the same issue while tinkering on Windows10 FF61.0.2.
| Command | Target | Value |
|---|---|---|
| store | 42 | myVar1 |
| store | 42 | myVar2 |
| assert | myVar1 | myVar2 |
As well as various combinations of the assert using ${} or not.
I also tried using echo to show what I had in var1/2 and it throws another error:
| Command | Target | Value |
|---|---|---|
| echo | ${myVar1} | ${myVar2} |
or
| Command | Target | Value |
|---|---|---|
| echo | >${myVar1}<->${myVar2}< |
I use >< to denote the beginning/ending of each value as static text for the output so I know if I'm seeing a space or nothing or trailing spaces, etc.

Ok, I'm not sure what I did different, but it appears to work now when used without the braces on the target.

Then I close the IDE, edit the file manually to change the suite name, open it, and it fails like before.
Misc Tests-ff.zip
Thanks for the additional info. I'll add a migration to offer backwards compatibility when using brackets. As for the CSP eval error on FF, it's a bug that we'll need to look into.
v3 is going to be gone soon, and v4 is an electron app
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.