Get Attribute Activity to tell if button is 'disabled' or not


#1

Hello,

I am back again.

This time I think I found a solid workaround for the problem I have been facing with Data Scraping.

I feel pulling all the HTML and then parsing thru the data to get the required information is the most consistent way of doing so with this web application (if anyone has an alternative please let me know).

Well, let me walk you through what I am trying to do.

I am pulling HTML that is located inside a DIV tag, then parsing thru those lower tags to get my required information (Name, Address etc…).

However, the data will span multiple pages in some instances. I have attached a snapshot to this which shows the HTML code for this particular button.

Whenever I reach the last page the ‘button’ tag will have a ‘disabled’ attribute equal to “disabled” when it has reached last page. This can be indicator that I no longer need to move forward and can finish automation.

However, instead of parsing thru each tag which will suck up memory I am wondering if there is a quicker way to parse thru HTML to get both the required info I need (NAme, Address etc…) AND the button tag status (disabled or not). Has anyone done something similar to this and can provide some helpful hints?

Does this seem like a reasonable approach?

Thanks so much.


#2

Hey @AutomateWork

As per your question title if you wants to check that particular button is disabled or not then please visit this thread and let me know :slight_smile:

Regards…!!
Aksh


#3

Thank you aksh1yadav,

I actually tried using the '‘aaname’ attribute but it actually doesn’t pull anything back for some reason.

Thus I have to try an alternative method.

To be honest, what is most important is being able to parse thru HTML data consistently (key word here lol)…have you ever dealt with this?


#4

You can also use Get Attribute Activity to get an “aastate” attribute if it is disabled then it’s value will be unavailable, focusable and if it is enabled then it’s value will be focusable.
according to this activity output you can proceed further.

Yeah have to deal with it… what here can help you is use “UI Explorer” and observe the properties of Html data elements :slight_smile:

Regards…!!
Aksh


#5

Hmm I am unsure how to use the UIExplorer to do this?

How am I able to specifically point to the element that I need inside of UiPath?


#6

To get and understand the properties of an html element so you can get the values using “Get Attribute” Activity you should aware of the uipath studio attributes. so follow this link and check it out.

Regards…!!
Aksh


#7

Apologies, I should have clarified better.

I know how to use UiExplorer to identify elements.

However, what I am unsure how to do is look at certain elements when the number of said elements (in this case patient line items) can vary…the last page may have 6 line items where the preceding pages have 10.

How would you go about accounting for this?


#8

They will follow some kind of pattern or attribute, will you please share some example html selector for that and screenshot as well.

Regards…!!


#9

Attached is a screenshot with a side by side of the web page I need to extract.

It looks like all the line item content is held inside the highlighted DIV tag under the ‘aaname’ property.

However, I am unsure how to properly point to this throughout each page and then properly parse thru the information to get the data.

So would it be better to pull the outer DIV tag content (which holds ALL line item content) or go thru each individual DIV tag to pull each line item.

Below is the selector for the outer DIV tag:

html app=‘chrome.exe’ title=‘Search Results | Providers’ /
<webctrl css-selector=‘body>div>section>div>div>div>div>div>div’ parentid=‘mainContent’ tag=‘DIV’ aaname=’ Nguyen, Laura Truc, MD Family Practice |*’ class=‘resultsWrapper’ isleaf=‘0’ parentclass=‘results’ title=‘Search Results | Providers’ /

Below is the selector for one of the inner DIV tags:

html app=‘chrome.exe’ title=‘Search Results | Providers’ /
webctrl css-selector=‘body>div>section>div>div>div>div>div>div>div’ parentid=‘mainContent’ tag=‘DIV’ aaname='Nguyen, Laura Truc, MDFamily Practice| *'
class=‘first’ isleaf=‘0’ parentclass=‘resultsWrapper’ title=‘Search Results | Providers’ />


#10

Ahh so much busy so asking others here to help you @AutomateWork :slight_smile:

@vikas_reddy_Vicky @sankar.kuna @Lucas.Pimenta @acaciomelo

Will you please help on this ?

Regards…!!
Aksh


#11

You could probably use the activity Find Children targeted to the element that has ‘results’ class.
It will return an IEnumberable that holds all its child elements. It would be a dynamic approach since it does not care if it has 1 or 10 elements or search results in this case.

Here is an Example xaml (7.2 KB)

Hope it helps!


#12

Topi,

Thank you so much for the help. The Find Children definitely works, however I am wondering if you can iterate thru this output to get each individual tag that houses the info I need?

In other words, when I use Find Children it will give me back all info for first line item (all of which I assume are held in separate tags) is there a way where I can iterate thru each of these and then allocate to variables?

Robert


#13

Hey @AutomateWork

Yes you can get the tag by using “Get Attribute” Activity.

For your reference please find the attached sample workflow and let me know :slight_smile:

Get_Tag_name.xaml (9.4 KB)

Regards…!!
Aksh


#14

There are probably nicer ways of doing this but I came up with a couple of solutions.

  1. If the ‘separate tags’ you refer to are always identical you can just use them as selectors at a Get Text -activity(assuming you want the innertext/value rather than the TAG name) that is inside a For Each -Child element loop.

  2. If the ‘separate tags’ vary or are not always there you can do another Find Children and then do another For Each loop with these child elements and use Get Text to get the values of those.

GL,
Topi


#15

Aksh,

Thank you for helping out with everything!


#16

Hope …Next time will have more time for you @AutomateWork :slight_smile:

Regards…!!
Aksh