Also i tried
${e}.includes (“tim”) == true
${e}.includes(“tim”) == true
${e}.includes(tim)
${e}.includes(“tim”)
(${e}.includes(tim))
and command indefOf also not work .
Thanks mate this woks for search .But if we want to tell to Executescript gotolabel A if contains the text or gotolabel B if not contains then how to do ?
This is because executeScript**_Sandbox** does not support the ES6 javascript command “.includes”. => The solution is to use .indexof instead of .includes.
So this version with .indexOf works in the sandbox:
{
"Name": "include string test",
"CreationDate": "2022-10-10",
"Commands": [
{
"Command": "store",
"Target": "test tim meyer",
"Value": "e",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "if (${e}.indexOf (\"tim\") > -1)\n{\nreturn \"YES, it contains this string\";\n}\nelse\n{\nreturn \"NO, it does not contains this string\";\n}\n",
"Value": "Result",
"Description": "The ES5 alternative to .includes is .indexOf"
},
{
"Command": "echo",
"Target": "${Result}",
"Value": "blue",
"Description": ""
}
]
}