You are on page 1of 2

Laboratory Work: Selenium WebDriver Basics

Objective: The objective of this laboratory work is to introduce the fundamentals of test
automation using Selenium WebDriver. We will set up a simple Selenium project, create
test scripts, and execute them to automate browser interactions.
Prerequisites:

• Selenium WebDriver and a compatible web browser (e.g., Chrome) should be


installed on their computers.
Instructions:
Step 1: Environment Setup (15 minutes)

• Ensure that Selenium WebDriver and a compatible browser driver (e.g.,


ChromeDriver) are installed on your computer.
• Set up a new project in your preferred Integrated Development Environment (IDE)
for your chosen programming language (e.g., Java or Python).
Step 2: Test Script Setup (15 minutes)
• Create a new test script that:
• Launches a web browser (e.g., Chrome).
• Navigates to a sample web page (e.g., https://www.example.com).
• Performs a simple action like clicking a button or filling out a form.
Step 3: Element Locators (20 minutes)
• Enhance your test script to locate and interact with page elements using different
locators (e.g., id, name, xpath, cssSelector).
• Verify that your script interacts with the correct elements.
Step 4: Assertions (15 minutes)
• Implement assertions to verify the correctness of the interactions. For example,
check if a specific element is present, visible, or contains the expected text.
Step 5: Test Execution (15 minutes)

• Execute your test script and observe the browser automation in action.
• Check the test results and ensure that any assertions are correctly validating the
page.
Step 6: Cleanup and Documentation (10 minutes)
• Implement cleanup steps to close the browser gracefully after test execution.
• Document your code with comments to explain its purpose and how it works.
• Prepare a brief report or README file summarizing your findings, any challenges
faced, and the results of your test.
This laboratory work focuses on the core concepts of Selenium WebDriver and provides a
practical introduction to test automation. It is designed to be completed in a single session,
making it suitable for a 90-minute class. Encourage students to ask questions and seek
assistance during the lab session to ensure a productive learning experience.

You might also like