gotoIf - Error in condition of gotoIf_v2: Invalid or unexpected token

{
  "Name": "gotoiftest",
  "CreationDate": "2020-10-17",
  "Commands": [
    {
      "Command": "store",
      "Target": "Sold",
      "Value": "searchText"
    },
    {
      "Command": "store",
      "Target": "Sold",
      "Value": "rowText"
    },
    {
      "Command": "gotoIf_v2",
      "Target": "\\\"${searchText}\\\"!=\\\"${rowText}\\\"",
      "Value": "done"
    },
    {
      "Command": "label",
      "Target": "done",
      "Value": ""
    }
  ]
}

I’m getting an error at Line 3.
The two variables are actually from other sources, but I hardcoded them to check the formula and it looks like gotoIf is set up incorrectly. I followed exactly what they did in the below post, so I’m not sure what the error could be but I’d like to fix it.

You re-used code from the deprecated gotoIf command with the new gotoIf_v2 command.

GotoIf_V2 uses executeScript_Sandbox

UI Vision Selenium IDE++ V5.0 uses executeScript_Sandbox to evaluate the expression. The old “GotoIf” continues to use storeEval. Please read here about the difference.

In the macro source code the new version of GOTOIF is “Command”: “GotoIf_v2”. The old version continues to use “Command”: “GotoIf” for backward-compatibility.

After updating to the new syntax it works:

{
  "Name": "syntax",
  "CreationDate": "2020-10-18",
  "Commands": [
    {
      "Command": "store",
      "Target": "Sold",
      "Value": "searchText"
    },
    {
      "Command": "store",
      "Target": "Sold",
      "Value": "rowText"
    },
    {
      "Command": "gotoIf_v2",
      "Target": "${searchText}!=${rowText}",
      "Value": "done"
    },
    {
      "Command": "label",
      "Target": "done",
      "Value": ""
    }
  ]
}
1 Like

Thank you!

Post must be at least 20 characters
Have you tried the button?