Skip to main content

How to auto PDF download in chrome browser?

· 4 min read
Süeda Gül
RPA Developer

In a world where PDF documents reign supreme for sharing and preserving content, the need to download them efficiently is a common task. Whether it's research papers, user manuals, or reports, we all find ourselves needing to gather PDFs from the vast expanse of the internet. However, manually downloading each PDF file can quickly become a tedious and time-consuming process.

One such remarkable feature in our RPA tool is the browser package—a comprehensive suite comprising 23 meticulously designed nodes. From opening browsers to capturing screenshots, these nodes offer a versatile set of capabilities that can revolutionize the way we interact with web content.

In this blog post, we will explain how to automate the process of downloading PDFs using Browser Automation with Robomotion.

Visual Snapshot

Flow Overview

How to Setup?

To begin, Log in to your Robomotion workspace. If you haven't registered yet, you can create your workspace from the provided link.

About Browser Package

The browser package refers to a collection of nodes that are specifically designed to interact with web browsers. These nodes enable automation of web-based tasks and processes by providing a set of actions that mimic human interactions with a browser.

The browser package consists of 23 nodes, each representing a specific action that can be performed within a web browser. These actions range from basic functions like opening and closing browsers, clicking on elements, and navigating forward or backward, to more advanced operations like capturing screenshots, handling alerts, and even executing custom scripts within the browser environment.

Flow Steps

  1. ‘Inject’ node is used to initialize the flow.
  2. The "Config" function node contains JavaScript code designed to define variables.

Function Node Named “Config” Code-Block:

//User Directory Path to save Chrome settings 
msg.user_directory_path = "YourUserDataDirFolderPath";
//Download Path to save PDF files
msg.download_path = "YourDownloadFolderPath";
//Give a url for the pdf file to download
msg.url = "https://www.fedex.com/content/dam/fedex/us-united-states/services/Fees_Shipping_Information.pdf";
return msg;
  1. During the initial run, you should establish a connection to the "Save Settings" sub-flow node, which comprises four individual nodes:

Save Settings Sub Flow Overview

    1. The "Create User Data Dir" node within the "File Create" category is used to generate the "User Data Dir" folder at the specified path.

Create User Data Dir Properties

    1. The node called "Create Download Dir" under the "File Create" category is used to establish the "Download Folder" at the provided path.

Create Download Dir Properties

    1. The node labeled "Open Browser First Run" is used to select the browser type and initiate the browser driver on the machine.

Open Browser Properties

    1. The 'Open Link First Run' node is used to navigate, directing you to the specified URL.

Open Link Properties

    1. Once the page loads, follow these steps to save your settings:
  • Open Chrome Settings.

Choose Settings

  • On the currently displayed page, navigate to "Privacy and Security".

Select Privacy and security settings

  • Choose "Site Settings".

Select Site Settings

  • Choose the "Additional Content Settings".

Select Additional Content Settings

  • Choose the PDF documents.

Select PDF Documents

  • Select "Download PDFs".

Choose Download PDFs

    1. You can now stop the flow and disconnect the "Save Settings" sub-flow.
  1. Once the main flow has stopped and disconnected from the "Save Settings" sub-flow, you can proceed by establishing a connection to the "Open Browser" node. Subsequently, you can initiate the flow once more.

Open Browser Properties

  1. The "Open Link" node is utilized to access the provided PDF download URL. This action will trigger the opening of the webpage and initiate the immediate download of the PDF documents. The downloaded document will be saved to the designated "Download Folder" path, which is specified within the "Config" function node.

  2. The “Stop” node is used to stop the flow.

Here you can access the complete flow by clicking on the following link: https://casestudies.robomotion.io/designer/shared/RxwBFxvjVC3A4jqjF9LYZf