Array in Selenium IDE for running varialble

You can not use the store command to assign a value to an array. It must be done with executeScript, since array handling can only be done in Javascript (JS):

  • var newArr = ${array1}; Assign the Selenium IDE variable “array1” (it has the array) to a JS array “newArr”
  • newArr[2][1] = 'New value'; Assign the new value to the JS array cell (2,1)
  • return newArr Store the modified JS array back to the Selenium variable array1

Here are all the steps inside one Execute Script command:

{
  "Command": "executeScript_Sandbox",
  "Target": "var newArr = ${array1}; newArr[2][1] = 'New value'; return newArr",
  "Value": "array1"
},

Please see

2 Likes