Selenium IDE - entering values ​​stored in an array into a text field?

There the webpage I am trying to check has several text fields. I have reached such an extent that I can get all the values ​​in each text field and save them in an array, but I was fixated on how to enter the same values ​​into the text fields again.

Here is what I still have in Selena:

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

The stored variable "count" is just the number of rows in the table and does not cause a problem. The part I completed in red is where the problem lies.

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

enter image description here

This continues to the end.

The variable "i" is correctly inserted, but for some reason, instead of capturing this value, it simply enters it into the text field.

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

The following is a problematic line:

type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${textBoxArray[${i}]} | 
+6
source share
3 answers

I am using the Selenium library through the Robot Tests Framework. I do not use the IDE, I just use HTML to create test cases and define new keywords.

When I want to access a list item, I just use the following syntax

@ {list_variable_name} [0]

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

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

Try also $ {textBoxArray } [$ {i}], because it seems like you are simply losing the last one incorrectly.

Learn more http://robotframework.googlecode.com/svn/tags/robotframework-2.5.4/doc/userguide/RobotFrameworkUserGuide.html#list-variables

+2
source

I think you need to replace the link to ${textBoxArray[${i}] link

 javascript{storedVars['textBoxArray['+storedVars['j']+']']} 

Read this blog post for more information, especially in the section "Setting and getting variables."

Quote from the article, consider

 store | 10 | x 

This obviously sets x = 10. There are several ways to refer to it: $ {x} or storedVars ['x']. They are not the same.

In particular,

You cannot assign anything to $ {x}.

+1
source

You can insert another command before your problem line:

 getEval | storedVars['text'] = storedVars['textBoxArray'][storedVars['i']]; 

And change the problem line to:

 type | javascript{this.browserbot.getUserWindow().getTestingHooks('TextBoxValue_' + storedVars['i'])} | ${text} 

It will also be useful to declare your array at the beginning of the test:

 storeEval | new Array() | textBoxArray 
+1
source

Source: https://habr.com/ru/post/894746/


All Articles