storeEval command unexpected token - v5.5.7

Hello,

With the latest version (5.5.7) I have encountered an error on a macro which had been working fine for around 2 years. This seems to relate to how the storeEval command is being handled. I tried on both Firefox and Chrome and the error was the same. Thanks for any help as this script is very helpful to us simplifying a mundane task. A sample is below:

    "CreationDate": "2018-4-10",
  "Commands": [
    {
      "Command": "store",
      "Target": "fast",
      "Value": "!replayspeed"
    },
    {
      "Command": "csvRead",
      "Target": "csvname.csv",
      "Value": ""
    },
    {
      "Command": "store",
      "Target": "${!Col1}",
      "Value": "InputDate"
    },
    {
      "Command": "echo",
      "Target": "Date = ${InputDate}, Username = ${!COL2}, Password = ${!COL3}",
      "Value": ""
    },
    {
      "Command": "storeEval",
      "Target": "${!csvReadLineNumber}+1",
      "Value": "!csvReadLineNumber"
    },

[error] Error in runEval code: Unexpected token '{'

storeEval is a deprecated command, maybe it was not tested enough in the new release? I am not sure, I have not used it for a long time :wink:

Solution: You can easily convert this line to

executeScript_sandbox | return parseInt(${!csvReadLineNumber})+1; | !csvReadLineNumber

1 Like

@admin
Another function that was turned off silently?
But it is still in demo macroses!
DemoCsvReadWithWhile is failing, both on while_v1_deprecated and then on storeEval_deprecated.
Maybe it’s a good idea to update them to working lines? Like in example by Ulrich?
Or you have some new function instead of storeEval? Can you please share that function?
Thanks in advance.

was not turned off. But I confirm that there is a bug with storeEval in V5.5.7. Test macro below.

Having said that, the command was deprecated long time ago, and with the last update we removed it from our command dropdown. It is no longer part of our standard QA. So we missed this regression issue.

Solution: The solution is very easy. Just switch to the better alternative executeScript and executeScript_Sandbox commands. They fully replace all features of storeEval!

Details described here:

https://ui.vision/rpa/docs/selenium-ide/storeeval

Test macro:

The first test case with storeEval works fine, the second one when using variable inside no longer works, as reported by @Gdrock33 .

{
  "Name": "storeval",
  "CreationDate": "2020-4-28",
  "Commands": [
    {
      "Command": "store",
      "Target": "10",
      "Value": "i"
    },
    {
      "Command": "storeEval",
      "Target": "Math.floor(Math.random()*11)",
      "Value": "i"
    },
    {
      "Command": "echo",
      "Target": "i=${i}",
      "Value": "green"
    },
    {
      "Command": "storeEval",
      "Target": "\"${i}\" + 1",
      "Value": "i"
    },
    {
      "Command": "echo",
      "Target": "i=${i}",
      "Value": "blue"
    }
  ]
}
1 Like