Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Selenium IDE - Typing values stored in an array into a textbox?

There's a webpage I'm trying to test that has multiple textboxes. I've gotten to the point where I can retrieve all the values in every textbox and store them into an array, but I'm stuck on how to type those same values into the textboxes again.

Here's what I have so far in Selenium:

What I have so farLarger view: http://i.stack.imgur.com/rb93k.png

The stored variable 'count' is simply the number of rows in the table, and isn't causing a problem. The part I've circled in red is where the problem comes in.

When I run this test, instead of typing the value stored in the array at that index, it simply types:

enter image description here

This continues all the way until the end.

The variable 'i' is properly inserted, but for some reason instead of grabbing that value, it simply types it into the textbox.

Does anyone know how I can get the correct value in the array?

Below is the problematic line:

type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${textBoxArray[${i}]} | 
like image 241
Michael Bautista Avatar asked Aug 10 '11 18:08

Michael Bautista


1 Answers

i'm using Selenium library through Robot Tests Framework. I'm not using any IDE, just using HTML to make test cases and defining new keywords.

When ever i want to access a list variable item, i just use the following sintaxe

@{list_variable_name}[0]

note that ${variable_name} is to access a single value variable or the reference to the list variable. If we want to access a list item we need to use @ instead of $.

If i understand your situation right, @{textBoxArray}[${i}] should work for you.

Try also ${textBoxArray}[${i}] because it seems that your are simply misplaycing the last }.

More details at http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html#list-variables

like image 187
Zecas Avatar answered Sep 23 '22 23:09

Zecas