Find Word in HTML

Hello,

I have an HTML document where I’m looking for a specific word that is in a table. Now I need an approach that allows me to search this particular word and then copy the value to the right of it.


I have already tried different methods and found “Find Element”. UiPath can read the word, but I get “UiPath.Core.UIElement” as output and not the word itself. With “GetText” I copy the value to the right of the word. This works fine. In addition, I have replaced the exact value of the selector with a wildcard (*). Then I have the problem that UiPath takes the first result of the table instead of the value which stands on the right from the word I search for.
On the example of the table I want to find the word “Höhe” and would like to copy the value “345”. When replacing the exact value with the wildcard *, however, I get the value “123” from the first attribute in the table. So, the RPA doesn’t find the word in my opinion.

Can someone help me to find a method to find the exact word on the page and get the right value?
I am very grateful for every tip!

Best regards

Buddy kindly follow the below steps that could resolve your issue
@cathschaen

  1. use find text position activity and pass the text input as “Hohe” and output will be a uielement get that output variable as out_element
  2. Here comes the solution for you
    use a anchor base activity, with find element on left side and get text on right side
  3. pass the variable out_element obtained previously as input to element property in find element,(no need to mention the selectors if uielement is passed as input)
  4. while in get text do the same as how you did previously to get the element and create selectors, change the dynamic one with wildcards as well,
    Thats all buddy you are done

Kindly let know whether this works or not
Cheers

1 Like

First of all thanks for the fast reply @Palaniyappan , but I still have some questions.

grafik

That is what it currently looks like, but I still have problem with following steps:
3.I am not sure how to pass the variable, to the find element activity. I put it in Target → Element, but I get an error (The following overload groups are configured: Element, Selector. Only one overload group should have its arguments configured.)
4. I previously tried to solve my problem with an anchor base activity, but I still have the same problem with it: I can’t change the selectors like I want to (over Ui Explorer)
grafik

Would be really cool, if you could help me. :slight_smile:

Buddy @cathschaen
You were almost done buddy

  1. for second one, use only one as a key to help the bot to find the element, so if you mention the element dont use selector, remove that selector property empty and mention the element property with the variable that you obtained from find text position.
    image
  2. Buddy once select the element in get text activity you cannot make changes with that element buddy, doesn’t mean that it will act dynamically it will act for sure,

Try this and let know buddy

Cheers

did that work buddy @cathschaen

The anchor based activity still doesn’t work. When I select the value “345” I get as output the marked element instead of the value.

Thanks again for your help, do you have an idea for the problem @Palaniyappan ?

1 Like

Great try with data scrapping… may be that can give us a datatable with which we can get the data we need
Kindly try and let know buddy

This can guide you buddy

Cheers @cathschaen

1 Like

@Palaniyappan I can extract the data with data scrapping and get a datatable. I understand the basics to work with datatables in UiPath but i have no idea about all the functions that exists. How would you extract the data I need? Could you give me a tip? :slight_smile:

Great so now you were able to get the datatable right
Fine to get the data you need from the datatable kindly follow the below steps

  1. use for each row loop to iterate through each row in the datatable by passing the datatable obtained from data scrapping as input
  2. use a if condition like this
    row(“Bexeichnung”).ToString.Equals(“Hohe”)
    if this condition gets passed in then part of if condition use a assign activity to get the right value of it like this
    assign activity if the right value of Hohe is in 3 column then
    outright_value = row(2).ToString

Thats all buddy this would give you the right value as you expect

Kindly try and let know buddy @cathschaen
Cheers

1 Like

were you able to get that value buddy @cathschaen

@Palaniyappan You are my hero! It worked - thank you! :slight_smile:
Spalte
Have still some problem with the column titles. So instead of “Bezeichnung” I have “Column-1”. Do you have an idea how to change? I found some Videos but they only worked with excel files as input.

And what if want to search for more words. Do I need to do a “For each row” activity for every word I want to search?

1 Like

Thats amazing buddy,
Fine

  1. Once you get the datatable from scrapped data, remove datarow activity to remove the first row by mentioning the row index in the property that would remove the row
    ,Bezeichnung,
  2. Fine then you can change the column like this
    myDataTable.Columns(0).ColumnName = “newColumnName” using an assign activity
  3. Yes buddy you can use for each row loop to iterate through each rows in the datatable buddy and use assign activity like this
    Out_value = row(“columnname”).ToString

Thats all buddy you are done…
Kindly let know once it it works
Cheers @cathschaen

1 Like

is that working buddy @cathschaen

It’s working. Thank you so much @Palaniyappan :slight_smile:

1 Like

Thats amazing

Cheer
Keep going buddy

1 Like

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