selenium-ide

How do I put a variable in the parameters of an array


I want to put variable in the parameters to specify element of an array by doing this:

${array[${index}]}

but, it just prints the whole text.

Input:

${array[${index}]}

Output:

"${array[${index}]}"

Edit:

So here is an example:

execute script | return ["first", "second"] | array

execute script | return 1 | index


Input:

type| id="inputbox"| ${array}[${index}]


Expected output:

"second"


Real Output:

"first,second[1]"


Solution

  • You need the correct syntax for putting an index variable as a parameter to the array? Is this what you want to accomplish:

    ${array}[${index}]
    

    Here is an example of how to get access the array element by index:

    enter image description here