.includes () is also an ES6 feature so it does not run in the “updated” executeScript_Sandbox.
The ES5 replacement of “.includes” is lastIndexOf ("searchForThis") >= 0
Example: We test if the string contains “cat” :
{
"Name": "includes",
"CreationDate": "2022-5-18",
"Commands": [
{
"Command": "store",
"Target": "fox dog cat",
"Value": "searchme",
"Description": ""
},
{
"Command": "store",
"Target": "cat",
"Value": "searchfor",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "var haystack1 = ${searchme}; var needle = ${searchfor}; return (haystack1.lastIndexOf(needle) > 0);",
"Value": "result",
"Description": ".includes done with lastIndexOf ES%"
},
{
"Command": "echo",
"Target": "${result} ",
"Value": "green",
"Description": "TRUE because the string contains CAT"
},
{
"Command": "if_v2",
"Target": "${searchme}.lastIndexOf(${searchfor}) >= 0",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "cat found!",
"Value": "green",
"Description": ""
},
{
"Command": "else",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "echo",
"Target": "cat NOT found!",
"Value": "pink",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
]
}