How to find out specific attribute in a table of a web page using UiPath?

Hi, My web page has a table, consisting of multiple rows and column. I want to traverse with each row of that table and find out the “Date of Birth” column value of that row. After that, for a specific DOB value, I want to click on “Details” text button on that row. How can I achieve this? Please help me in this regard. Thanks.

Are you able to provide the selectors?

Try using UiExplorer to see what attributes are of the details, i.e. specific row indentifier / hyperlink for you to click.

Another option could be to simply create your own datatable within UiPath Memory with all of the information and open a new tab using that hyperlink rather than clicking on details

Hi there @nuibb

I guess find children activity is a good way to approach this.

  1. Go to inspect element in your webpage and check under which attribute your DOB and other href is housed under.
  2. Then find children of the main DIV under which all these UiElements come under.
  3. Under the filtering parameter of the Find children activity

"<webctrl YourTagName='YourAttributeName'/>"

you can filter with your attribute name.
4. Then get attribute of your ‘specific’ DOB and check whether it matches your input DOB and in the same loop get the attribute of (generally ‘href’) and use ‘Navigate to’ activity after breaking your loop.

Hope this helps :slight_smile:

Regards

PS : You should be quite familiar with the find children activity for this

I can’t say that I’m a fan of the Find Children approach, but has its use occasionally.

I think the easier approach is scraping the structured data. You can do this by clicking the Data Scrape wizard in Studio Menu Ribbon. This will get all the data on your table usually with the column names too.

However, you only need to scrape the data if you don’t have any information prior from another source. For example, if you already have an excel file with the information, then you can skip the scraping step, and directly click the link.

Let’s assume that you want to click each Details link. Use UiExplorer on it and verify that there is a “tableRow” attribute. If there is, then you can use this with the Get Attribute to find the row attribute for that row, which makes this simple.

So here are the steps:

1) Extract Structured Data (using Data Scraping) to dtVariable
2) For each row In dtVariable
3)    Get attribute "tableRow" of either Name or Date of Birth item using the value in the aaname attribute
        "<webctrl aaname='"+row("Date of Birth").ToString+"' />"
4)    Click Details using tableRow variable from the Get attribute
       "<webctrl tag='A' tableRow='"+tableRow.ToString+"' />

That’s pretty much how I do it and works well. Typically, you won’t need to scrap the data because the value will come from another excel file.

Regards.

2 Likes

There’s also another approach, that I keep forgetting to check as well. So you can try this too…

Look in UiExplorer on the other trees for an attribute that includes values in that row.

Here is an example:
image

So by checking the aaname in the other tree line will give you the link within that same row.
In this example, the selector would look like this:
"<webctrl parentid='oaTabContent0' tag='TR' aaname='*"+row("Today").ToString+"*' /><webctrl aaname='30 yr fixed' tag='A' />"

So steps in this approach would skip the Get Attribute for tableRow:

1) Extract Structured Data
2) For each row in dtVariable
3)     Click Link using adjusted selector

Regards Regards.

1 Like

This is also a good approach. But I am not so sure as to why scraping the data is more optimal or preferable for such a scenario than find children… He has to go through a single column which can be anything ( not mentioned whether it is a Table node or just divisions under divisions. ) @ClaytonM Is there a specific reason as to why it shouldn’t be considered first?

Regards :slight_smile:

1 Like

Hi, thanks, let me explain my opinion on this.

There are two main reasons which I don’t prefer the method:

  1. In most cases with businesses, you need the data scraped so you can output this data somewhere, either for logging what the robot executed or for the end user so they can use the data with further steps. Or, also, typically with businesses, you will already have the data which you want to extract for, which in that case, you would not need to scrap the data but only use the information you already have to find the link and click on it directly with selectors.
  2. Find Children, essentially, gets all tags within a division, therefore you must make sure you filter to certain tags. And, then, you must create conditions to ensure you are clicking or interacting with the correct item in the list of children. I believe this method can be more complicated. Understanding how to use the filter property perfectly might make this less complicated, though. Find Children is closer to how I would automate a web interaction through VBA, where you get the child tags, and loop through them until you find the correct one you want to interact with (this was before I used RPA tools).

Like I said though, I think Find Children can be a useful method sometimes. But, most of the time you can use Selectors directly.

If the data is in TR or TD tags (a table), the information in the row can be used to directly click the link in the same row. If you were to use a basic Find Children, then you would just loop through each link, not knowing the information in the row - I suppose if you don’t need to get the other data from the row and just click every link, then that would be ok.

I hope that makes sense

Regards

1 Like

Hi,

Great explanation. I understand your perspective. Eliminate the easier prospects and then go into something like find children (which I agree can be complicated at times) if inevitable.

Ah, if you already have the data then I wouldn’t prefer it either, it takes up more memory by keeping the page source in the collection.

Thanks for the input. :slight_smile:

Regards

Hi, Thank you so much for all of your responses. At the moment, I can get the attribute but unfortunately can’t make a click event on “Details” link on the table? What I actually did, I used data scraping tool from UiPath ribbon and loaded my required data into a data table. After filtering that data table, I got my desired row where I get a dynamic function under “Details” link, not the real url. That dynamic function create the real url if only user click on the “Details” link. Unfortunately I couldn’t make the click event on that dynamic function under “Details” link on the data table. How can I achieve this?

Here is my dynamic function format which I get after data scraping on “Details” link in the data table :

http://javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(“ctl00$siteContent$gvEligibilityPrimaryPpo$ctl02$lbMemberBenefitsRba”, “”, true, “”, “”, false, true))