selenium-ide icon indicating copy to clipboard operation
selenium-ide copied to clipboard

CSP error when using assert command in Firefox

Open barancev opened this issue 8 years ago • 16 comments

@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

barancev avatar Sep 03 '18 13:09 barancev

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

M3ssman avatar Sep 03 '18 13:09 M3ssman

Can you share the assert that you've written?

corevo avatar Sep 03 '18 13:09 corevo

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

M3ssman avatar Sep 03 '18 15:09 M3ssman

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!

tourdedave avatar Sep 03 '18 16:09 tourdedave

@M3ssman do you get a CSP error when using |assert | myVar | 42 |?

tourdedave avatar Sep 03 '18 16:09 tourdedave

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'

julienb81 avatar Sep 04 '18 13:09 julienb81

@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 avatar Sep 04 '18 13:09 M3ssman

@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.

tourdedave avatar Sep 04 '18 14:09 tourdedave

@julienb81 Try | assert | myVar1 | ${myVar2} |

tourdedave avatar Sep 04 '18 14:09 tourdedave

@tourdedave Thanks, it works

julienb81 avatar Sep 04 '18 14:09 julienb81

@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

M3ssman avatar Sep 04 '18 18:09 M3ssman

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.

2018-0904_172714-snap

98gmarquee avatar Sep 04 '18 22:09 98gmarquee

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

Then I close the IDE, edit the file manually to change the suite name, open it, and it fails like before. 2018-0904_181032-snap Misc Tests-ff.zip

98gmarquee avatar Sep 04 '18 23:09 98gmarquee

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.

tourdedave avatar Sep 04 '18 23:09 tourdedave

v3 is going to be gone soon, and v4 is an electron app

toddtarsi avatar Nov 10 '22 05:11 toddtarsi

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.

github-actions[bot] avatar Dec 11 '22 01:12 github-actions[bot]