How to get all text from the same selectors on a web page

How would I get multiple items that have the same class and input them into an array in UiPath.

Example:

<div class="folder" id=1>
Folder A
</div> 
<div class="folder" id=1>
Folder B
</div>

<div class="folder" id=1>
Folder C
</div>

<div class="folder" id=1>
Folder D
</div>

<div class="folder" id=1>
Folder E
</div>

The bot should then put these folders in an array with values:
Folder A
Folder B
Folder C
Folder D
Folder E

Hi @imqureshi,

In order to achieve it, I suggest you to basically use the Find Children activity and once you have all the children elements from your top level HTML element, you may iterate between them. While iterating them you may get the necessary information by using the Get method when your variable is of UiElement type. You may also use the Get attribute activity to get this value.

Please check the example that I have uploaded below with a custom HTML page that looks like the one you have provided.
example.zip (34.4 KB)

3 Likes

Wow excellent, thanks so much!

1 Like