Collecting Text from Browser and Storing in an Array?

How can I store text obtained from a browser, using the ‘get-text’ function and a ‘for-each’ loop, for multiple iterations (e.g., 4 times) , and then display the full array containing all the collected text? @Anil_G @Palaniyappan

1 Like

Fine

Welcome to UiPath forum

  1. First have a list variable created using assign activity like this

List_output = New List(Of String)

Where list_output is a variable of type System.collections.Generic.List(of String)

  1. Now use a for each loop and inside the loop use GET TEXT Activity and save the value in a variable named Strinput

  2. Inside the same loop use a ADD TO COLLECTIONS activity where mention the item property as Strinput and collections property as list_output

Now all the values obtained will get saved in the collection list variable

Then u can use it as a list or as array by converting to array like this

arr_output = list_output.ToArray()

Or

You can get that as a string like this

Stroutput = String.Join(“-“, arr_output)

Hope this helps

Cheers @GopiKrishnan_Srinivasan

Hi @GopiKrishnan_Srinivasan

Welcome to Community!!

Try this

Assign: collectedText = collectedText.Concat({currentText}).ToArray

@GopiKrishnan_Srinivasan

you can use list instead of array

create an listvariable and initialize it new list(of string)

in the for each loop use assign activity

listvariable=listvariable.append(yourstring).tolist

outside the loop use log message

string.join(“,”,listVariable)

is this you are expecting

but ADD TO COLLECTION is not showing!

1 Like

@GopiKrishnan_Srinivasan

you can also use assign activity

listvariable=listvariable.append(strinput).tolist

There are many ways to add it a list

Use can search for this append item to collection
https://docs.uipath.com/activities/other/latest/workflow/append-item-to-collection

@GopiKrishnan_Srinivasan

Thank You ! I got the desired result

1 Like

Cool
Then would recommend to close this topic

Cheers @GopiKrishnan_Srinivasan

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