Download from variable list of files

I need to download from a list of links from a website that vary on a daily basis. For example, today I can see the following

image

I need to click on each of the download links to download each of the files and save them

image

How can I loop through all the links?

can u share website link

It is a restricted website (https://copilote4.fineasy.com).

If it helps, the selector for the download button is as follows:

If I select the 2nd, the selector is as follows:

<html title='Copilote' />
<webctrl idx='2' parentid='content' tag='A' />

I guess I need a way to find out how many index links there are and then loop through them (somehow)

You could try using FindChildren activity from the container (use the content element for it) with filter like <webctrl tag='A' />.
It will give you an Enumerable<UiElement> that you can ForEach through.

@andrzej.kniola: thanks the the guidance.

I donā€™t seem to be able to find the children though.

See the XAML file attached. Iā€™ve added a text box to show me how many items are found, but if finds none

Also, Iā€™m attaching the html code that I think it is relevant to the download items in the website it helps to define properly the Find Children activity.

webSite.html (1.1 KB)
testting.xaml (13.6 KB)

Thanks for the attachments, it helps to see the structure.

There seems to be a little misunderstanding on how to use FindChildren.
Selector property should point to the container, or in other words first common ancestor.
Filter property should describe what children/descendants you want to find.

In your attached workflow Selector is pointing to a link (or a) element already, and that has no children.

Set your Selector property to something like this (Iā€™m guessing how it looks - check with UiExplorer)
<html title='Copilote' /> <webctrl aaname='content' tag='DIV' />

Set the Filter property to:
<webctrl tag='A' />

You could also check with Scope being FIND_DESCENDANTS instead of FIND_CHILDREN, depending on if itā€™s directly under your container or further down.
Try also searching for other topics with FindChildren, there were some examples somewhere on the forums.

Inside the ForEach donā€™t use selector in the Click activity - pass the item into Element property instead, so that it will use previously found element directly.

Let us know how it goes.

1 Like

Thanks @andrzej.kniola. I managed to do some progress with your advice.

I have found the children with "<webctrl />", but it founds 7 rather than 6 (there are 6 download links) With <webctrl tag='A' /> doesnā€™t find anything. Iā€™ve tried to select different parts of the web site, but it didnā€™t make any difference. What Iā€™m selecting now is the part of the screen where the download links are located.
image

Maybe web scrapping the page and counting how many ā€˜Downloadā€™ links I could find might help instead?

Selecting item into Element property gives me an error message.
image

I managed to make it work with a do while loop instead. The problem I have is that as it finds 7 elements it gives me an error at the end when trying to find and element that can not find.

testting.xaml (12.8 KB)

Try with this one:
testting (1).xaml (14.3 KB)

Iā€™ve added a childrenFoundArray = ChildrenFound.ToArray to be able to access via index and changed clicks and highlight to use prefound elements.
In the ForEach changed TypeArgument to UiPath.Core.UiElement - it was left as default (Object).

Also added a WriteLine with .Selector.ToString and innertext attribute in the loop and changed the condition a little (you can compare counts directly and string comparison would break if above 10 as with strings "2" < "10" = False). If all of them will return ā€œDownloadā€ and the weird one will return something else, you could filter it out or omit in an If.

Itā€™s interesting that it doesnā€™t find anything with tag ā€˜Aā€™, as judging by the selectors themselves it should, or Iā€™m missing something.

2 Likes

Pertect!! Thanks @andrzej.kniola. This works very well. And thanks also for the .Selector.ToString tip. The process gets the headings, but like this I can exclude it and just pick up on the ones containing ā€˜Downloadā€™

Thanks again!!

I tried your solution, but i can not write a line with .selector.toString. There is only ā€œ.selectā€ expression, could you plz help me?

I have the same issue with you but i can not write a line with .selector.toString. There is only ā€œ.selectā€ expression. could you please tell me what should i do?

Can you post a screenshot or your xaml?
Are you sure your element is of type UiElement?

Ohhhh, thankU,!! As you said, my element is not a type of UiElement!! Now I solved my problems!