Quantcast
Viewing all articles
Browse latest Browse all 3160

Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

Data scraping or web scraping is the process of importing data from a website and saving it to your local system or any other device. It’s one of the most efficient ways to get data from the web, and in some cases to channel that data to another website .

Create UiPath Project in UiPath Studio

You can open UiPath studio and choose project type “Process “


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

It will open a dialog box and you can give the name and description for the project. Click “Create” button to proceed further.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can drag a “Sequence” activity from Activities pane to “Main” work area. “Sequence” and “Activity” are the main terms in UiPath . We will add more activities to this "Sequence" activity.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can add “Input Dialog” activity to sequence. Please search for “Input Dialog” and drag to the sequence.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can give “Title” and “Label” properties to this activity. This dialog will ask for user input while running the process. Please note in UiPath all the string values must be entered inside the quotation mark only. Integer values can be entered without quotations.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can add a new variable and map this variable with our “Input Dialog” activity.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

I have created the variable with “String” variable type and scope as “Sequence”. Please note I have given my C# corner user id as the default value. The default is not mandatory.

We can map this variable to “Input Dialog” activity. You can add this variable to “Result” property of “Input Dialog” activity.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can add a new activity for opening a browser. For that, we will use “Open Browser” activity.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

You can drag this activity next to “Input Dialog” activity. Give the C# corner URL to this activity. Please note I have concatenated the URL value with User Id variable so that “Open Browser” activity will open the web page of the C# Corner user which we will capture from the Input Dialog box.

Inside the “Open Browser” activity, there is again a “Do” sequence. We will add more activities to this sequence to fetch the data from the website.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can define the browser type property. W e can add one more variable to define the Browser. This new variable will be used to close the browser tab after we fetch the data from the website. The type of this variable must be “ UiPath.Core.Browser ”.

Choose the custom data type from drop down.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

You can search for “browser”. It will filter the “ UiPath.Core.Browser ” type. You can choose this custom data type.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We have added the “Browser” variable now.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can map this variable with our “Open Browser” activity. Go to the properties of this activity and set “ BrowserType ” as “Chrome” and “ UiBrowser ” as “ varBrowser ”.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

When our process starts, the browser will open in Google Chrome with the variable. Later, we will use this browser variable to close the Browser tab.

We are going fetch “User Name”, “Rank ”, “Read”, “Reputation”, “Membership Type” from C# Corner website for a given user.

We can use the “Get Text” activity for that.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

Drag this activity inside the “Do” sequence in “Open Browser” activity.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

You can click the “Indicate element inside browser” link button to mark the position of data which we want to fetch from the website. Here I am going to fetch “User Name” from the C# Corner website.

You must open the C# Corner website for a user to mark the data points. I opened with my username.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We have successfully marked the username in the website.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can add a variable and map this variable with the above text value.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can select the properties of “ Get Text” activity and map the variable.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

We can repeat the above steps for “Rank”, “Read”, “Reputation” and “Membership Type”.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

You can see that there are 5 variables mapped with all “Get Texts” activities.


Image may be NSFW.
Clik here to view.
Data Scraping From A Website And Save To SQL Server Using UiPath (RPA)

You can create a table “ CsharpCorner ” in existing or new SQL Server database.

CREATETABLE[dbo].[CsharpCorner]( [Id][bigint]IDENTITY(1,1)NOTNULL, [UserId][varchar](25)NULL, [UserName][varchar](50)NULL, [UserRank][varchar](25)NULL, [UserRead][varchar](25)NULL, [UserReputation][varch

Viewing all articles
Browse latest Browse all 3160

Trending Articles