How to get attribute from a class

Can anyone help me on how to get the attribute from a class on a website? I am trying to webscrape the href of an element from a website, but the visible elements do not have the href, as the href is kept in a class that holds all the visible elements.

Hi @Martins_Micheal

Can you please show snapshot from uiexplorer for this element?

usually, you should be able to get the value of an attribute by usung get attribute and specifying the name of the attribute.

for e..g “aria-disabled”

@Martins_Micheal

indicate the element in ui explorer and check in the right top and left bottom windows if required values are there. If yes then those properties can be retrieved via get attribute

sometimes few inner elements might have it use left top window to explore inner elements

cheers

This is the uiexplorer for the website - https://unleashnfts.com/explore/overview.

I want to scrap the href in the </> A

@Martins_Micheal

if you see href is present but it shows the relative path

also if you look in left down there is a url property as well

cheers

Yeah. The href for this element shows but the href for the next </> A do not have their href among the selected items. is there any way that I can solve this while also using a for each ui element for the task. Thanks Anil.
I will appreciate becoming your mentee hehe

@Martins_Micheal

What is it showing then?can you show a screen shot of that?

Cheers

the href box is not automatically selected

Hi @Martins_Micheal

If you scroll down in left bottom property explorer, I think there is a property which has the whole url.

Can you please check which property name is that?

You should be able to use the same to get url

Thanks but that is the url of the current page. I want the link to the second page without opening it (href). in addition, how can I open a new tab without closing the current page? Thanks

@Martins_Micheal

Do you see a part of the url which refers to current page and which changes when you move to next page?

If yes, u can fetch url property and replace a part of it to include href in that url and hit it to navigate to second page

@Martins_Micheal

The href box need not be selected to retrieve the value of it…any property /attribute can be retrieved irrespective of it being selected or not ..the only thing is the property should be present for that selector

The selection is to make your selector dynamic and unique for that field but not to have the value of each attribute in selector

Cheers

If you want to extract the href from a class that contains it as an attribute (not directly in <a> tag).


:small_blue_diamond: UiPath Steps (Short):

  1. Use ‘Open Browser’ or ‘Use Application/Browser’.
  2. Use ‘Get Attribute’ activity:
  • Target: The element/class that contains the href (use UI Explorer to indicate it).
  • Attribute: "href" or any custom attribute like "data-href" depending on how it’s stored.