Extract URL from webpage elements

I need to get a URL from a webpage, but since it’s not simple HTML, I’m not sure how to extract the information. Right now I’m using a Get Text activity and it’s getting the anchor using CV (computer vision). It’s also using CV to scrape the text, but it’s making mistakes with zeros and ohs, 5 and S, things like that. UI Explorer can’t find exactly what I’m looking for since it’s in an IFrame.

If I’m on the webpage and click Inspect on the text/URL I need, I see this:

Are there any activities that I can use to retrieve the URL after the “Direct link to download:” string?

@cgoldstein,

  1. You can extract the full text of the <p class="ok"> into a string
  2. Split the string with : character
  3. The returned arrays second item would be your link.

Thanks,
Ashok :slight_smile:

Thanks @ashokkarale , can you help me a little more?
I used a Get Attribute activity. I selected the target as the part of the page that will have the URL. I set the Attribute to “class=”“ok”“” (using two double-quotes around ok to escape them), and Saved to my DownloadLink variable.

During runtime, I get this error: Get Attribute ‘msedge.exe Q2’: Attribute not supported by the current UiNode.

Hi @cgoldstein

please refer the below thread.

  1. First of all you can keep UiPath.uiautomation.activities with latest version.
  2. Also can you please try with find children or find element activity.

@cgoldstein,

How you build the selector, can you show please?

Thanks,
Ashok :slight_smile:

Thank you for helping me!
I’m updating the UiPath.uiautomation.activities to 23.10 now, but I doubt that’s the issue. This is just over my level of development. The webpage isn’t simple HTML, it’s built in the vendors package and seems to be in an IFrame. UIexplorer can’t find the text/element. I’m not sure how to find the selectors/elements/children.

If I right-click and view frame source, I see the HTML and the URL I need to get:

<div class="details">
 <p class="ok">
  Report has been attached to Salesforce Case xxxxx
 </p>
 <!--<p class="ok"><a href="https://customer.yyyyy.com/servlet/servlet.FileDownload?file=012345g6HHRR1" target="_blank">Direct link to download: https://customer.yyyy.com/servlet/servlet.FileDownload?file=012345g6HHRR1</a></p>-->
 <p class="ok">
  Direct link to download:
  <br/>
  https://customer.yyyy.com/servlet/servlet.FileDownload?file=012345g6HHRR1
 </p>
</div>

I just don’t know what activities to use to get the URL after the Direct link to download. Once I have a whole string, I can figure out how to parse it and just get the URL.

Why are you using CV? If you’re getting selectors you don’t need CV. CV is for image based automation (ie Citrix).

You should be able to just indicate the link (which will be tag=‘A’) as the UI element for Get Text.

@postwick , when I target the element in the Get Text activity, I get a message “Could not detect any text elements using native scraping.” It automatically switches to CV.

Sounds like it’s not able to identify it as an “A” tag. You’ll have to just Get Text on its parent element (tag=‘P’ class=‘ok’) and then use RegEx to get the URL out of the resulting text.

That’s pretty much what I just did. I’m grabbing more text than I need and using a RegEx to extract the URL.