Selector - two same elements issue


I have a page, poorly designed of course, where initially we have a row of 4 input fields, and ability to dynamically add more fields. When you click on + (plus) to add more fields, 4 new input fields get created and my luck, of course, these have exact same name (no ID) - nothing that distinguish it from field right above it … only idx attribute (which changes sometimes - it starts from 1 and sometimes from 2 or 3 – so it’s not an attribute I could use.

It would be awesome if I had value=“” check - so that selector only used input field with name=“blaaaah” and value=“” (because previous field was already filled with something else).

Tried anchor - that id not work because it’s dynamic.

Any suggestions?


There are probably several ways to get past this, it would help if you could show the corresponding part of the HTML.

The first technique that comes to mind is the Find Children activity, which should work perfectly if these inputs are the only children of a parent element. You can then make a loop with a Type Into, using the child elements instead of selectors.

Another way is to navigate through the inputs with the tab key: first make sure you have the required number of fields using the + button. Then Click on the first field, which should have idx='1' in UiExplorer, and loop over your input values to Type Into, each value followed by a tab key. The selector can be left empty if the activity is within a browser scope.

You should also definitely be able to include the value or other attributes in your selector (check the Property Explorer in UiExplorer). These can be typed directly into the appropriate element of your selector in UiExplorer, followed by Validate, to make sure it is still correctly identifying the same element.

Yet another way I’ve used recently may work if there are textual labels with the inputs. In this case you may be able to get to the input element of your choice by performing a click on the related text element and typing a tab key. In my case I could then conveniently reach the following inputs with more tab keys.

Hi @Kemal,

Try to get some more attributes using uiexplorer.

And also you getting different idx value…so based on that also you can get the values from the input fields.

All the selector are same but only thing is idx changed so you can do create dynamic selector and increment by "1’ the value to get the input values.
Before getting the value check element exists activity to check the last element…if if returns false value you need to break it.
Make sure the idex value is unique and its increment value one by one.

Else you can use find Children activity
To get all the input element.
Using for Loop you can Loop through it using get value activity you can get the value.