Select Item / Drop Down Menu Duplicate

Hi ,
I have a Dropdown menu i need to select,
but this drop down Menu have duplicate values ,
which i must be able to select each of them and verify if its the correct one ,

so my scenario like this

example dropdown:
A
B
C
B
D

what i need to do is fist select B on first drop down and check if B = fulfill my condition
if not i will need to select B on 4th Drop down and check if = fulfill my condition

then it will will trough all same duplicate ,
if duplicate not found then i will assign a var as = "Fail "

need any idea to go trough this looping of duplicate drop down

Regards
Ahmad

Hi,

In this case,I recommend to use Inject JS script activity and select item by index number.

For example, the following sample selects item which has “a” by index number.
This can select each item even if they have same name.

Sample20221130-6.zip (3.2 KB)

Regards,

Hi Yoichi i have tested using this way

Get the list of items on the list passed as an string
then call them using string[10-1] for the 10th item of the array ect.
See attached.

do you think this way is ok?,

caused i tested and i get the correct index and value

REgards
ahmad

HI,

I don’t think this way can select 2nd same name item.

image

Does this work in your environment if there are same name items?

Regards,

yup it does work,

so

  1. i read the attribut of the drop down then save it inside an array
    2.i do for each of the index to see of the current index value fulfill my condition
    if yes then select the index
    if not then continue for each

3.after the index have been found then do select item using
theitems(ItemtoSelect-1)

the items = array of drop down value
item to select = value from POINT Number 2

I Will also test your workflow shortly , but i need someone else opinion on this way im using it

Thanks

Hi,

I just checked behavior of SelectItem activity. In my environment, if there are same name items in the options, we can only select last item of them, even if select the first one.
So, if your selectItem doesn’t behave the above, it’s no problem, however, it might be better to check it in details.

Regards,

Hi Yoichi ,

youre right , i tested and sometime it works some times not,

i will try your way

thanks!

Hi Yoichi ,

your solution can get the corerct index , but after it choose the dropdown the info that should be auto show up on the page after we choose a dropdown didnt load soemehow ,
means the web didnt consider it as dropdown been chosen.

regards
ahmad

Hi,

It might not be fired event. For now, can you try the following JS code in InjectJSscript activity?

"function(e,v){
    e.selectedIndex=v;
    e.onchange();
}"

OR

"function(e,v){
    e.selectedIndex=v;
    var evt = new Event('change');
    e.dispatchEvent(evt);
}"

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.