Automate clicking on list to download (no Hyperlink attribute)

I am trying to download some files from my company webpage server for a bunch of listings (due to internal webpage, I could not link it here). Please see image below on the structure of the webpage. For each listing, I have to download 2 .pdf files (Attachment A, and Attachment B)

The problem is that, the attachments do not seem to have a ‘href’ attribute to be used (right clicking on them do not return a ‘Copy Link Address’). The only way I can download is to click on it.

What I have done so far
I have used the data scraping to get the entire listings over all the pages, but only in text (datatable) format, no URLs were returned.

How could I dynamically click through each .pdf file to download it? I am thinking to use the Click activity, but I am unsure how to loop through the entire list. I suppose the ‘For Each Row’ in the datatable doesn’t work here.

image

Appreciate your advice please.

@Ben_l

Use the modern folder please find the below activities as shown, try with that under application scope use click to download it will work

image

Thanks
Varun

Hi @Ben_l

You could do it by using ‘Click’ activity. I would suggest you to use ‘Indicate Anchor’ option in UiExplorer or ‘Anchor Base’ activity. As an anchor you can take text “Document # 000X”.

The question regarding iterating through whole table and if you may use ‘For Each Row’ activity - it depends on how the datascraping worked and what results did it return. The question is also do you need to iterate through the pages?

Thanks @Marta , I have taken your suggestion and use the Anchor Base activity, with Anchor at Attachment A (and B) and managed to click the pdf documents, for a single document (Document # 0001).

How do I continue simulate the click of the remaining documents, and also on the next pages?

Update

Apparently, each of the Anchor (i.e. Find Element) has an unique idx (for example Attachment A and B below). I understand I might need a While loop to go through each of the Element (i.e. the Anchor).

Attachment A
image

Attachment B
image

However, I am unsure how to reference the idx for the While loop though. How can I update the idx automatically for the selector of Anchor?

In order to dynamically update idx attribute you should use some kind of a counter in a loop and with each iteration you should change it accordingly (eg. increase by 1). You can put that variable into the selector.

Depending on the version of UiPath Studio you have, it may look a little bit different, but you can do it in 2 ways (I used some random selector for this example):

  1. In ‘Edit Selector’ window do the right click on idx value and choose ‘Use Variable’ option. It should look like this:
    image

  1. Directly from Properties panel → Target section → Selector property

    You can the use one of the formulas:
String.Format("<html app='chrome.exe' title='Automate clicking on list to download (no Hyperlink attribute) - Help / Studio - UiPath Community Forum' /><webctrl parentid='{0}' tag='BUTTON' />", intRowIndex)

or

"<html app='chrome.exe' title='Automate clicking on list to download (no Hyperlink attribute) - Help / Studio - UiPath Community Forum' /><webctrl parentid="+intRowIndex.ToString+" tag='BUTTON' />"

Moving on to the iteration thorough pages I would use the approach to implement the following logic:
Check if the element with current value of idx exists.
If yes, we can download attachments from current page and increase the iterator/counter to continue the loop.
If no, we need to check if “Next page” element on the page exists. If yes, we can continue the loop (remember about resetting value of the iterator/counter if needed since idx may be set to 1 again on new page).

Thanks @Marta, I have tried implementing a While loop with the idx variable you suggested. The right click - create variable works as below.

image

But strangely, when running the debug, on the first iteration (i.e. idx = 1), the idx_exist variable (result of the ElementExist) returns false (see attached image below).

image

Can’t figure out the error in the sequence though. Am I doing the selector correctly?

Can you please share this workflow?

There may be multiple reasons why this is not working. Firstly, I would double check the whole selector (including the first line indicating the application). I assume you are using some kind of Attach Window/Attach Browser activity? Maybe you are attaching to the wrong window?