Data Scraping - how to get an attribute value insead of innertext?

Hi,

this is the html tag:

<span title="Production network" uipath_custom_id="11" text_capture_x_custom_id="02/15/2018 08:58:31-1" style="">Zsn</span>

This is The extract metadata string generated by the wizard:

<extract>
<column exact="1" name="Z" attr="text">
	<webctrl tag="tr"/>
	<webctrl tag="td" idx="6"/>
	<webctrl tag="span" idx="1"/>
</column>
</extract>

With this metadata the inner text “Zsn” of the span tag is being extracted. But how to get the attr value of title=“Production network” and not the “Zsn” text?

Thanks

1 Like

@LukJas,

Title parameter has it.

get attribute with Title params

Regards,
Dominic :slight_smile:

Hi
How do I apply the get attribute to the metadata XML?
The span tag is within a table with with 0:n rows.

@LukJas, Can you indicate the entire table for selector and try choosing the Title parameter ?

regards,
Dominic :slight_smile:

you have to set or replace the attribute you want to get in the column tag
<column exact=“1” name=“Z” attr=“text”>

if you want to get the title attribute you have to change the attr like this
“<column exact=“1” name=“Z” attr=“title”>”

Hi, I have an issue with GetAttribute. After data scraping, I loop through the rows using For Each row. Inside that there is a Get Attribute to read the href. But it is only reading the first row .
The selector for the GetAttribute is set as (attached pic)


How to make it go to next row and fetch that unique href value for each row?

error_gettingAttributes|690x387

Please follow the below steps.

  1. Using the UiExplorer make the selector in such a way that there is an IDX value present and has a value of 1 for the first-row element
  2. Use do while loop with the condition element exist output
  3. Initialise a counter variable
  4. Make the selector dynamic with the counter for IDX value
  5. Add element exist inside the loop with the dynamic selector
  6. Use if condition to check if element exists
  7. Using get attributes activity to fetch the required value

Hope this helps.

Hi , thank you for the quick response.
I checked the uiexplorer . there doesn’t seem to be any idx property.

  • Idx should be automatically generated , right? How to force it to set to 1

  • Where to find the idx? If you can please refer the attached screenshot, where I inspected the element ,there doesn’t seem to be any unique id which i can use as a counter to fetch next row.

Could you please send a snapshot of UI explorer after capturing the element.

Hi , i fixed the problem of getting the idx to move one by one row and get the attribute.
I faced another problem. If there is 10 rows per page, it only fetches the data for firstpage. After that it throws error saying there is no idx=11 found.

After you looped through the first page. Check if the next page element exists If it does, loop it back to while loop after clicking on the next page.

If possible upload the code.

thanks …will try it out and post the code if it works