Getting the error [error] Cannot read property 'find' of undefined on using else if

I’m trying to use else if with a different value everytime of a variable but getting the error Cannot read property ‘find’ of undefined.

Could you please help on this.

“Command”: “verifyElementPresent”,
“Target”: “xpath=//a[contains(@title,‘abc’)]”,
“Value”: “”
},
{
“Command”: “while_v2”,
“Target”: “{!statusOK}", “Value”: “” }, { “Command”: “storeText”, “Target”: “xpath=//*[contains(@id,‘def’)]”, “Value”: “name” }, { “Command”: “echo”, “Target”: “{name}”,
“Value”: “”
},
{
“Command”: “if_v2”,
“Target”: “{name}.includes (“diksha”) == true”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//a[contains(text(),‘Vehicle’)]”,
“Value”: “” },
{ “Command”: “elseif”,
“Target”: "{name}.includes (“baluja”) == true”,
“Value”: “”
},
{
“Command”: “click”,
“Target”: “xpath=//a[contains(@title,‘abc’)]”,
“Value”: “”
},
{
“Command”: “end”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “pause”,
“Target”: “11000”,
“Value”: “”
},
{
“Command”: “endWhile”,
“Target”: “”,
“Value”: “”
},
{
“Command”: “”,
“Target”: “”,
“Value”: “”
}

Hi @admin could you please help on this ? Thank you so much

It seems the $ is missing in front of every variable?

Instead of

if | {name}.includes (“diksha”) == true

use

if | ${name}.includes (“diksha”) == true

This works:

{
  "Name": "1",
  "CreationDate": "2019-9-26",
  "Commands": [
    {
      "Command": "store",
      "Target": "abc",
      "Value": "name"
    },
    {
      "Command": "if_v2",
      "Target": "${name}.includes(\"abc\") == true",
      "Value": ""
    },
    {
      "Command": "echo",
      "Target": "yes",
      "Value": ""
    },
    {
      "Command": "end",
      "Target": "",
      "Value": ""
    }
  ]
}

Hi @ulrich I’m using “else if”
I re tired by using $ symbol and it still throws the same error