Objective
The objective of this practice problem is for the user to demonstrate an understanding of the Web Browser commands discussed in the previous section by creating an automation that utilizes those commands. The commands covered in the previous section were the Selenium Create Browser, Selenium Navigate to URL, Selenium Navigating Back and Forward, Selenium Getting Browser Info, Selenium Refresh and Selenium Close Browser Application commands. In the future, these commands may be implemented into other practice problems.
Scenario
An employee of the ABC company is working on a project that requires an Excel workbook containing important information of E-Bay Browser Page and price of Graphical Processing unit (GPU, also known as a Video Card).
Prerequisites
There are no prerequisites required for this exercise.
Practice Problem Requirements
The user must create an automation that performs the following tasks:
  • Create a browser and navigate to the URL of the webpage
  • Get the required browser information
  • Search the for a specified item and extract the price
  • Creates a new Excel File
  • Enter the required details in the Excel Workbook (item name, website title, item price)
  • Save and Close the Excel Instance and the browser once the other commands have been completed.

Problem Difficulty: Medium
Solution will be provided on the next page with a brief explanation.

Solution
The code for the solution has been provided below.
As a quick summary: 

Step 1: The Selenium Create Chrome Browser will open a web browser and navigate to the eBay website.

Step 2: Selenium Get Browser Info will get the required information about the browser which the user specifies (In this case: Window Title).

Step 3: Selenium Get Text/Set Text/Click Element specifies which item/element on the website to select and perform actions (Extracting information, clicking a link, etc.).

Step 4: Create Excel Application will open a new or already existing Excel Workbook to input the extracted value into the worksheet.

Step 5: Write Cell will enter the text to the specified cell in the Excel Workbook.

Step 6: Save As Workbook will save the new Excel File to a specified location.

Step 7: Close Excel Application will close the instance of opened Excel Application.

Step 8: Selenium Close Browser will close the browser that was used.

Newsletter Bot

Lets stay in touch!

Join our weekly newsletter and follow us on social media.

Contact Sales
Call Our Experts!