Mutiple replace of values in same macro code

Learn better Javascript. With Javascript and executeScript or executeScript_sandbox.
See executeScript, execute script, Arrays - Selenium IDE Commands Tutorial

Example:

{
  "Name": "replace-variable",
  "CreationDate": "2019-12-9",
  "Commands": [
    {
      "Command": "store",
      "Target": "var newval = \"\";var m = [\"\",\"January\",\"February\",\"March\",\"April\",\"May\",\"June\",\"July\",\"August\",\"September\",\"October\",\"November\",\"December\"];for(var i=0;i<m.length;i++){if(i == mycheck){newval = m[i];}}",
      "Value": "replace_month"
    },
    {
      "Command": "store",
      "Target": "5",
      "Value": "Var1"
    },
    {
      "Command": "executeScript_Sandbox",
      "Target": "var mycheck = Number ${Var1};eval ${replace_month};return newval;",
      "Value": "shownotification"
    },
    {
      "Command": "echo",
      "Target": "${shownotification}",
      "Value": ""
    }
  ]
}
1 Like