Web Scraping in Uipath
So let’s start with what is Uipath ? It’s a low code platform for Robotic Process Automation . We can create bots with different capabilities and deploy it for use reducing the manual , structured and predictive works done by humans .
When it comes to web scraping it’s the process where we deploy bots to get the content from the web. There are different tools like beautifulsoup to extract data but Uipath does the same process in seconds
Web scraping :
Aim : To scrape the phone name and price from Amazon website and store it in the excel
Step 1 : Create a process in Uipath studio and name it as Recording_Amazon
Step 2 : Go to recording -> Click Web you will get a pop screen like this
Step 3 : In your browser go to google search ( www.google.co.in )
Step 4 : Go to Open browser activity and indicate the URL
Step 5 : Then click Type activity and indicate the search bar and type amazon
Step 5.1 : Check Empty Field button so that any previous searches would be deleted and the search content would be typed accordingly
Step 5.2 : Once you have typed amazon , press enter button on the keyboard
Step 6 : Once you typed amazon go to Click activity and indicate the google search button
Step 6.1 : Once you have done this you will land up in this page (Note : Sign in to amazon if you haven’t before recording the following steps )
Step 6.2 : Go to click activity and click amazon.in
Step 6.3 : Type redmi phones and click enter
Step 6.4 : Go to click activity and indicate the search bar
Step 7 : Now comes the very fun part the scraping . Go to text -> scrape -> Scrape data and you will land up in a extract wizard
Step 7.1 : Indicate the name of the first phone
Step 7.2 : You will get another extract wizard click next and indicate the name of the next phone
Step 7.3 : Now that you have indicated you will get an pop up like this
Step 7.3.1 : Rename the columns Phone Name , Phone link respectively and check the extract url column
Step 7.3.2 : You will get to preview data and you will have Maximum no of results as default 100 you can give it any
Step 7.4 : Give extract correlated data and indicate the price as the same steps as you did for phone name and the extract wizard looks like this
Step 7.5 : Click finish
Step 7.6 : We want to scan not just one page but multiple pages right like 1–126 like that so to indicate that you will get a wizard like this after you click finish. So give yes
Step 7.6.1 : Indicate the next button in amazon site
Step 8 : Give Save and Exit in Web recording . Once you save the workflow looks like this
Step 9 : In the Extract Structured Data ‘DIV search‘ activity check the properties you will see the details are stored in forms of rows and columns as Data Table in default to the variable ExtractDataTable
Step 9.1 : Go to the variables panel and change the scope of it from web to sequence
Step 10 : In the activities panel search for write range (File -> Workbook -> Write Range) and drop it after the extract activity
Step 10.1 : Give the excel name or browse the excel by click the folder icon and in the data table fill the datatable variable — ExtractDataTable.
Step 10.2 : Save and run the workflow . The excel will look like this finally
Tip : If you want to move down or up while recording itself press F2 or esc that activity go to the point where you want to do the activity and then record
Happy Recording with Uipath