The user must create an automation that performs the following tasks:
- Checks if the prerequisite file exists
- If the file exists
- Extract the value in the Stock Market Index column.
- Navigate to https://finance.yahoo.com/
- Search for the value that was extracted
- Extract the Stock Value and the Percent Change
- Fill in the Excel file
- If the Stock Value is greater than or equal to 11,150
- Write Yes in Column D
- If Stock Value is not greater than or equal to 11,150
- Write No in Column D
- Close the file and email the file to any email address the user desires.
- If the file does not exist
- Navigate to and search https://finance.yahoo.com/ for the IXIC Stock Code
- Extract the Stock Value and Percent Change
- Send an email with a message that contains the extracted Stock Value and Percent Change to any email address that the user wants.
Note: These are the values that need to be extracted from Yahoo Finance and be sure to run a test where the prerequisite file does not exist.
Problem Difficulty: Medium
The code for the solution has been provided below.
As a quick summary:
Step 1: Use an If Statement to check to see if the prerequisite file exists in the designated folder.
Step 2: If the file exists, open it and extract the Stock Market Index.
Step 3: Navigate to Yahoo Finance, input the Stock Market Index into the search bar, and click the search bar using Web Browser commands.
Step 4: Extract the Stock Value and Percent Change values and then input them into the file. If the Stock Value is greater than or equal to 11,150, write yes in Column D. If not, write no.
Step 5: Close the file and email it to another user.
Step 6: If the file does not exist, navigate to Yahoo Finance, and enter IXIC into the search bar, and click the search bar using Web Browser commands.
Step 7: Extract the Stock Value and Percent Change values and then send an email to a colleague that contains the values.