📣 Welcome to Day 5 of the UiPath Studio Web Workshop. In this session, we invite you to immerse yourself in real-world data retrieval and engage in a fun and interactive exercise. Join us as we explore the practical application of web scraping to find the temperature of selected cities and record the results in a spreadsheet. Additionally, participate in a lively exercise by attempting to guess random numbers in a sequence.
👉 Topics covered:
📌Task1: City Temperature Tracker
Utilizing Web Scraping to Retrieve Temperature Data
Printing the Results into a Spreadsheet
📌Task2: Random Number Sequences
Introduction to Random Number Generation
Interactive Exercise: Guessing Random Numbers in a Sequence
Speakers:
Vajrang Billlakurthi, Digital Transformation Leader, Vajrang IT Services Pvt Ltd. and UiPath MVP
Swathi Nelakurthi, Associate Automation Developer, Vajrang IT Services Pvt Ltd
Rahul Goyal, SR. Director, ERP Systems, Ellucian and UiPath MVP
👉 Visit the series page to register to all events.
4. 4
• Overview:
- This UiPath automation project aims to extract temperature data for cities provided in a spreadsheet and write
the extracted data into the corresponding temperature column in the same spreadsheet.
- Web scraping is utilized to retrieve temperature information from Google's search results.
- Note: During code execution, user interaction is required to grant consent for all cookies.
• Requirements:
- Navigate to www.google.com using a web browser.
- Access each city name provided in the spreadsheet.
- Search for the temperature of each city on Google.
- Extract the temperature value.
- Write the extracted temperature into the temperature column of the spreadsheet
• Variables Used:
- CurrentRow (Type: DataRow): Variable to represent the current row being processed in a loop
- Text Value (Type: String): Variable is dynamically generated by the activity and contains extracted temperature
1. City Temperature Tracker with Web Scraping
5. 5
• Navigate to Google:
- Use the Use Browser activity to navigate to the Google website.
• Nest all browser-related activities inside the Use Browser activity.
• Iterate Through Each City:
- Use For Each Row in Spreadsheet activity to iterate through each city name in the spreadsheet.
• CurrentRow: Autogenerated variable holding each city name.
• Search for Temperature:
- Use Type Into activity to input the search query for the current city's temperature.
• Type this *: Provide "Temperature in "+CurrentRow("Cities").ToString+"[k(enter)]"
Workflow Overview
6. 6
• Extract Temperature Data:
- Manually search for any city's temperature to indicate the location for web scraping.
- Use Get Text activity to extract the temperature value from the Google search results.
• Text Value: Autogenerated variable holding the extracted temperature.
• Write Temperature to Spreadsheet:
- Use Write Cell activity to write the extracted temperature into the temperature column of the spreadsheet.
- Determine the cell to write based on the Column, Current Row Index, and desired row position
• Cell: Provide "B"+(CurrentRowIndex+2).ToString
• What to Write: Provide Text Value Variable containing the extracted temperature
7. 7
• Overview:
- This UiPath project offers an interactive exercise where users guess a randomly generated number within a
specified range.
- The automation guides users through the guessing process, providing feedback on each attempt and
congratulating them upon successful guess.
- It utilizes Boolean variables, random number generation, delay, Get Asset, and conditional logic to create an
engaging guessing game.
• Requirements:
- Generate a random number within a specified range.
- Prompt the user to guess the randomly generated number.
- Orchestrator Assets are utilized to store the guess value
- Provide feedback to the user based on their guess.
- Allow the user to retry the guessing game if desired.
2. Guessing Random Numbers in a Sequence
8. 8
• Variables Used:
- isRetry (Type: Boolean): Controls the retry mechanism. Default value set to True.
- Output (Type: Integer): Autogenerated variable that stores the generated random number.
- Value (Type: Integer): Autogenerated variable that stores the guessed number retrieved from Orchestrator
Asset.
• Variable Setup:
- Create a Boolean variable named isRetry with a default value of True, , aiming to keep retrying until you
correctly guess the randomly generated number.
• Generate Random Number:
- Use Random Number activity to generate a random number within a specified range.
- Set Min and Max values accordingly.
• The Output variable is autogenerated that stores the generated random number.
Workflow Overview
9. 9
• Interactive Guessing Loop:
- Implement a Do While activity to engage users in the guessing process.
• Within the loop.
- Delay activity for 15 seconds to provide time for the user to input their guess at Orchestrator Asset
(e.g., 15 seconds).
• Retrieve the user's guess using a Get Asset activity.
- Set the folder path and choose the appropriate asset name (e.g., "Guess Number").
- Value autogenerated variable to store the user's guess.
• Use If activities to compare the guessed number with the generated random number.:
• If the guess is greater than the random number,
- Use log Message activity to display a warning message to try a lower number
• If the guess is lesser than the random number,
- Use log Message activity to display a warning message to try a higher number.
10. 10
• If the guess matches the random number,
- Use log Message activity to congratulate the user on their correct guess
- Use Set Variable activity to set 'isRetry' to False to exit the loop.
- Condition *:
• Provide Isretry variable
- Loop Continuation:
• The loop continues as long as isRetry remains True, allowing users to retry the guessing game if desired.
• Analysis:
• The project effectively engages users in a guessing game, providing clear instructions and feedback.
• It demonstrates the use of Boolean variables, random number generation, delay, Get Asset, and
conditional logic.
• Through the interactive exercise, users experience practical application of UiPath automation techniques.