UiElement - Last child of text

Is it possible to find the UiElement of a searched term? So for instance search for the text “House” and then when it has found the first element it will get the UiElement of this word?
Hope someone can help me!

Could you elaborate? When you say a word, will it be associated with a button or can it be part of paragraphs etc?

It will be a word where you can click on, which will lead to you to the specified page.

On this page (https://www.bol.com/nl/l/muziek/N/3132/?promo=music_360__A_30126-43771-alle-muziek_1_) it will be for instance ‘Hurts 2B Human’. I would search for this word with ctrl f function and then I would like the UiElement of this word/link.


You can do this by creating a dynamic selector. First capture any of the element, say Hurts 2B Human and make the property that matches to Hurts 2B Human dynamic.

  • Create a variable called title .
  • Add a click activity and select indicate on Screen.
  • Select any of the title you want say Hurts 2B Human.
  • Change its selector to "<html app=""chrome.exe"" title=""bol.com*"" /><webctrl aaname=""" + title + """ tag=""A"" />". Note: Paste this directly to selector field. Don’t use visual editor.
  • Once this is done, you can assign different values to title and UiPath will click them dynamically.

See the sample flow attached.
Main.xaml (4.9 KB)

Mark this as a solution if it helped.

But I do not want the robot to already know the page. So I’d like to have a website & a string as input for the workflow.
https://www.bol.com/nl/l/muziek/N/3132/?promo=music_360__A_30126-43771-alle-muziek_1_” and “Hurts”

Then the robot opens the websites and search for the string “Hurts”, then I would like to get the selector of this word.

You are doing this on a single website right? You just need to change value of the title variable and bot will click the link if available.

Yes but I would like the process to work on different websites, so that is why I want the website URL to be an input variable

That won’t be possible unless all the websites have the same structure.

But isn’t it possible to for instance; search for a word. Right click on the word to inspect the element? So this could work for any website right?

You need something to be added as a selector for the bot to understand where to right click.

The robot can right click on a searched word; then I can click on inspect element; but then UiPath does not recognize the page I think because I cannot click or copy anything in there. So I can get to this page

You might want to use the Find Children activity, this will return a IEnumerable<UIElement>.

Meaning that you probably start from a selector like <html title='bol.com | Muziek kopen? Alle Muziek online' /><webctrl id='js_list_view' tag='DIV' /> and do several Find Children iterations till you found you innerText with the specific match and use one of the <UIElement> (grand) parents depending on what you want to do next,

Yes this sounds great when I already have found one selector. The problem is I would like the selector of a text searched for the activity: click on text.

How many sites are you talking about? If you have a list of sites, you can capture the dynamic selectors from each of these sites and keep them in an excel file. Use UiPath to iterate through each and you can use the dynamic selector to pass different titles.

In that case, you probably just want to do Data Scraping, select the fields (e.g. #LikeMe and Hurts 2B Human) and than select both Extract Text and Extract Url:

Iterate through the DataTable and find the Url (in Column2) by looking up the your text (in Column1) as e.g. Hurts 2B Human