PingFleud
PingFleud

Reputation: 19

Selenium IDE Javascript creating array worked until restart?

I created and populated array in Selenium IDE, then used it for a while.

<tr>
    <td>storeEval</td>
    <td>new Array ('asd','Hot Dog')</td>
    <td>names</td>
</tr>

I got the number of items of the array this way:

<tr>
    <td>storeEval</td>
    <td>names.length</td>
    <td>length</td>
</tr>

After I restarted Selenium IDE, when I try to get the number of items, or echo an item from the array, I get the following error:

[error] Threw an exception: names is not defined

why would that happen?

in addition, while it WAS still working, I had 4 items in the array. Then i added more but when i tried to echo some of the new ones, it didnt work.

Upvotes: 0

Views: 998

Answers (1)

Nikhil Surendran
Nikhil Surendran

Reputation: 1006

Try This.

<tr>
    <td>storeEval</td>
    <td>new Array ('asd','Hot Dog')</td>
    <td>names</td>
</tr>
<tr>
    <td>storeEval</td>
    <td>javascript{storedVars.names.length}</td>
    <td>length</td>
</tr>
<tr>
    <td>echo</td>
    <td>${length}</td>
    <td></td>
</tr>

Thank You.

Upvotes: 1

Related Questions