Navigating to hyperlinks from multiple rows in a webpage and downloading zip file from each child page

Hi All,

I am new to UiPath and this is my first attempt at automation using UiPath. I do not have programming knowledge also.

Please help me find a solution for below:

Overall goal is to login into a webpage and navigate to specific section of webpage and reach the listing page and download zipped files from each listing.

The multiple listings (a minimum of 70 to 80) is appearing in a structured format and i am able to extract and write that into a excel/csv and store it in local system.
Column Names that is extracted and stored in a table are
Item Id, Created Date, Listing Status

Next i need to either generate the URL for downloading zipped file by using unique ID from datatable that was extracted and generate the URL myself like “www.amazon.com/id=” + Item Id

For this i added a new column as URL and set it with default value with the URL - eg:- URL = “www.amazon.com/id=

I am unable to concatenate the Item ID to the end of URL. Item ID is the extracted value and is available in the datatable but i am unable to use it in concatenation even after declaring it as variable.

Another method i tried is to

  1. Click into hyperlink from each listing page and download the zipped file. I am unable do this for multiple items in a webpage - it stops with first listing as the hyperlink is in Item Id column.

Due to confidentiality i am unable to share any screenshots. Let me know further inputs are needed.

Any immediate help would be really helpful

Hello vinoth_kumar2,

Are you using datacraping to get the 70-80 items, if so, do these items have on the webpage contain the correct complete link to your zip download? Then you could add a column with this link/url and loop trough the datarows of your extracted datatable and use the url there

if it does not contain it yet, you could loop trough each datarow of your datatable
and try to build your url like this
www.amazon.com/id=” + row(“Item Id”)

Thanks tbrinkman. Appreciate the quick response.

Yes, i used data scraping to get the 70 to 80 items. Yes, all of them have a sub-listing page which should be clicked and then in that detailed page the zip download link will be available. A direct download URL is not available in the structured table link. Hence the need of either navigation to sub-listing page for all rows or generating the sub-listing page URL.

I am not able to understand the 2nd para completely - can you elaborate on it? Should i use Datarow activity inside for each row and assign URL = “www.amazon.com\id=” + row(“Item Id”). I added URL a new column and have set it as default value with “www.amazon.com\id=”

Kindly advise.

I was thinking like this
image

could you sare the xaml file where you loop trough it right now?

I will provide more inputs on this which might help in providing a solution.

Below is what i was able to do so far:

  1. Created a sequence
  2. Opened a browser
  3. Logged into browser
  4. Navigated to first section in website - used navigate to and click activities
  5. Navigated to 2nd section in website - used navigate to and click activities
  6. Used Delay activity and loaded all results in a page (takes some time to load the results)
  7. Now from the results (70 to 80 as indicated earlier) need to click a hyperlink from all results and reach a one level more for all of them individually
  8. Used DataScrape function and downloaded the 70 to 80 results and exported that into a CSV and validated it - counts are matching. The count will change everyday. Data is in Structured format hence it was easy to scrape datatable.
  9. In all of the individual links there is a zipped folder download link
  10. Move downloaded zipped files to one consolidated folder.

Steps 7 to 10 are the ones i am struggling with at the moment.

Like mentioned earlier after the data scrape is completed - i am not able to move further - tried 2 options - generating individual URLs and then navigating to one level more and then use click into to download zipped file or using open browser and reaching the download link page (this worked for one row and i am unable to loop it)

Sorry if it is too much of text - learning how the tool works and working on something confidential hence skeptical about sharing images. Will create a sample workflow and send the .xaml file if the above does help to understand the issue.

Also do add, i tried the For Each Row activity but i am getting an error like we cannot convert datatable to string. Item Id is a column that was datascraped from website. If i try to declare it as variable i am unsure about to how to populate it with required value.

So in short I understand you have something like this (step 1-6)

step 7-10:

Yes, exactly the same. Only difference is i used Datascrape function to extract the 70 to 80 results and stored in ExtractDatatable, exported that as a CSV before step 7 from your image - rest all is good.

I also use DataScrape as last activity of first sceen shot and store them in dt (you call it ExtractDatatable)
then you can do your validation with the csv

afther that you can contiue using the datatable (dt/ExtractDatatable) since that contains all the information the csv is not needed for this step. and you can do the steps from the second screenshot
I can imagine you would like to store the download/move location in your csv aswel but I did not add this in this sceenshot

you could do this by looking at the filenames (posibly they contain the same IDs) or you could do it afther the move file step

Thank you so much - it worked fine overall. Additional challenges - please if you could help it would be helpful as well.

  1. When there is no Zipped Download Link available the sequence stops and does not move further - can we skip such URLs and move to next ?

  2. Sometimes there are blank rows created hence only "“www.amazon.com\id=” is available - can we either delete rows with Item Id as blanks or skip them and move further as well.

If i solve these 2 issues it will help me complete the flow.

You made my day with your responses - thanks once again.

2 is relative easy, you can just wrap the entire openbrowser “www.amazon.com/id=” +row(“item id”)
in a if activity

so first
if
condition: row(“Item Id”) <> “”

fixing point 1 is a bit different
does it crash on the move or on the opening of the browser?
You could wrap it all in a try catch and just do nothing in catch and continue

I tried creating the IF statement for point 2 and facing with compile error:
TestUpl

Have not tried point 1 solution as it might change based on above corrections. The sequence stops after the browser is opened - it realizes the download zip file link is not there and stops with an exception error.

Also one additional help, the browsers that are opened remain as is, can we close all of them once the file is downloaded - else i am ending up closing almost 70 to 80 browsers

Hi there,

Closing all browsers is not an issue if you dont need browser anymore for your immediate activity/action of the workflow (kill process will take care of it)

But data scraping is a different issue. If you trying your approach in a publick domain can you share that for me to build a workflow with step by step approach (like a small usecase)

Regards :slight_smile:

Thanks. I figured out closing the browser.

If you help on skipping to next listing if there is no download link and skipping listings where Item Id is blank would be helpful.

Process flow and steps are shared in earlier threads. tbrinkman was kind enough to create a dummy one for easy understanding.

the error is a result because I forgot to add a .ToString in the example

it should be row(“Item Id”).ToString <> “”

since it is opening the browser fine for point 1 the try catch will not solve the problem of geting stuck
In that case you will need to us a elementExcist activity to detect if you are on a valid page and use the result of this elementExist for your If case to say try download or else do nothing and move to the next item

Adding .ToString solved the problem and the loop is working fine…

Have eliminated the results without download link with a search criteria but will still add it to handle any exceptions and get back if i need help. It would be useful if you can provide the solution in workflow format.

Also all the files downloaded gets saved in download folder with other general download i have done. The Move activity is not moving the file and it throws an exception error saying file is not found. Is there a way to move the downloaded zipped files alone to another folder in desktop.

Kill process worked to close all the browsers that were opened.

I am using move file activity after kill process - not sure if that will have an impact.

I placed the Move function inside the loop still it did not work out. It says the file is not found. Not sure how to move the files to desired location

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.