List items repeat in a loop

for-each

#1

Hi All,
I copy a set of values from excel and store it in a list variable and enter the same in a webpage for downloading files. I use a for each loop to enter the value from the list and while entering the values it gets repeated i.e., i have 3 values in the list and while entering it executes as value1 and for second it is value1, value2 and for third the value1, value2, value3. I want only corresponding values to be entered each time. Kindly share the feedback on where i went wrong.


#2

Hi Arthi, please share your recording to have a look.


#4

Hi Arthi,

you mention a for each loop in your initial post, but I only see a while loop in your example?

Kind regards,

Thibault


#5

In each While Loop, you add a new element to a List variable, and then you you have Fore Each loop that performs all actions for all elements in the List. So in the first iteration, it does it for 1 element, then for 2 elements, and so on.

You don’t need a For Each loop in this case.


#6

Hi
The above logic works fine if i have to download only one file, and sometimes i have a scenario where i need to download more than one file in a web page and in that case the values are repeated twice. In such case how do i download other than using for each condition?


#7

Try using the For Each lop after While loop, not in it.

Sample-updated.zip (13.7 KB)


#8

Thank you so much :slight_smile: :+1: