Extracting Text from Get attribute output variable

Hi Team,

Input:

from get Attribute activity the output variable contains this below value
<a href="https://app.sc.ge.com/api/filemanager/v2/apps/1656/tenants/95/sysfiles/9605803\" target="_blank" rel="noopener noreferrer" style="color:#fff; text-decoration:none; font-family:Arial,Helvetica,sans-serif; font-size:13px; font-weight:bold">Download",

required Output:

href="https://app.sc.ge.com/api/filemanager/v2/apps/1656/tenants/95/sysfiles/9605803\"

Thanks
Likitha

Hi @vinjam_likitha

Use the below regex expression likitha

System.Text.RegularExpressions.Regex.Matches(yourstringinput.ToString,“(href=.*(?=\s+target))”)

Hope it helps!!

can you please share the detailed activities

Thanks
Likitha

Hi @vinjam_likitha

In Get attribute activity the result is saved in a string variable type.
Use the matches activity to extract the required output from the Get attribute result.
Follow the below workflow

In the Matches activity, click on the Configure regular expression option,
select the Regex dropdown to advance and paste the above regex expression in the value then hit on save. See the below image.

After this I have used the for each loop to iterate the result of matches activity. Because the matches activity output is in collection of matches.

Hope it helps!!

Hi,

Which attribute do you set? Is it “InnerHTML”? If so,can you try “href”? It may be return the URL.

Regards,

I set innerhtml value as an output.What is href?

I have a mail which contains Download button

Bot has to click on download button in mail body to download the input file

Subject should contain “Exported records to Excel”

How to write logic for it

Thanks
Likitha

Hi,

If you can directly indicate a-tag element , we can get href attribute as URL
href attribute has URL which move to when click.

Can you try to re-indicate element which has a tag or use visual tree and set a tag as target

Regards,

@vinjam_likitha

You can directly try this

Str.Split({"href="""},Stringsplitoptions.None)(1). Split({""""},Stringsplitoptions.None)(0)

Cheers