How to get all selectors from one web page

Hi all,

Is there any chance to get all selectors from specific web page and let’s say put in some list. I don’t know is there any library or activity which can do this action.

I need this because I want to get all selectors from all UI elements on that web page before process running. On this way I’ll always have fresh and newest selectors in list before process start.

Thanks a lot in advance.

Kind Regards,
Marko Kostic

1 Like

Have you looked at Find Children?

This will allow you to grab all elements and their various attributes. This produces a list of elements and you can then access the selectors of each child using child.selector.tostring

1 Like

Hi @ronanpeter,

This sounds great for me. Can you check just my sequence, something went wrong:

uiListOfElements variable type is System.Collections.Generic.IEnumerable<UiPath.Core.UiElement>
item variable type is UiPath.Core.UiElement

Thanks a lot in advance.

Kind Regards,
Marko Kostic

1 Like

in your For Each loop make sure the Type Argument is set to UiPath.Core.UiElement

image

1 Like

Hi @ronanpeter,

It is:

image

Maybe I need to put some attach window or something like that, because issue which appear when I try to print the value of one child in message box next window appear:

image

Thanks in advance.

Kind Regards,
Marko Kostic

That’s to be expected, you are iterating a list of UiPath.Core.Element objects. So your message box will simply state that for each element grabbed by the Find Children activity.

What you want to do is access the selector of each of those elements. So instead of item.tostring in your message box, put item.selector.tostring and you will see the details you need coming through.

3 Likes

Hi @ronanpeter,

Now it’s working. Thanks a lot for your time and help.
We can close this issue because it’s solved. Now I’ll continue to investigate other options with this kind of logic.

Kind Regards,
Marko Kostic

1 Like