Assignment
1️⃣ Selenium for Browser Automation (5 Assignments)
Assignment 1: Install Selenium and Open a Browser
🔹 Task: Install selenium and launch a browser using Chrome WebDriver.
🔹 Example Command:
pip install selenium🔹 Example Snippet:
from selenium import webdriver
driver = webdriver.Chrome() # Make sure you have ChromeDriver installed
driver.get("https://www.google.com")
print(driver.title)
driver.quit()Assignment 2: Open a Website and Get Page Title
🔹 Task: Open a website and print its title. 🔹 Example Snippet:
driver = webdriver.Chrome()
driver.get("https://www.wikipedia.org")
print(f"Page Title: {driver.title}")
driver.quit()Assignment 3: Take a Screenshot of a Web Page
🔹 Task: Open a website and save a screenshot. 🔹 Example Snippet:
Assignment 4: Find an Element by ID and Get Text
🔹 Task: Find the search bar on Google’s homepage and print its placeholder text. 🔹 Example Snippet:
Assignment 5: Scroll a Web Page Automatically
🔹 Task: Scroll down on a web page using Selenium. 🔹 Example Snippet:
2️⃣ Interacting with Web Elements (5 Assignments)
Assignment 6: Enter Text in an Input Field
🔹 Task: Search for a term on Google. 🔹 Example Snippet:
Assignment 7: Click a Button
🔹 Task: Click the Google Search button. 🔹 Example Snippet:
Assignment 8: Select a Dropdown Option
🔹 Task: Select an option from a dropdown menu. 🔹 Example Snippet:
Assignment 9: Extract All Links from a Page
🔹 Task: Print all links on a webpage. 🔹 Example Snippet:
Assignment 10: Close Popups and Alerts
🔹 Task: Handle a JavaScript alert popup. 🔹 Example Snippet:
3️⃣ API Testing with Postman (5 Assignments)
Assignment 11: Install and Set Up Postman
🔹 Task: Install Postman and make a GET request to https://jsonplaceholder.typicode.com/posts.
https://jsonplaceholder.typicode.com/posts.Assignment 12: Make a GET Request with Query Parameters
🔹 Task: Fetch data from an API using query parameters. 🔹 Example Snippet:
Assignment 13: Send a POST Request with JSON Data
🔹 Task: Create a new post using a POST request. 🔹 Example Snippet (Postman JSON Body):
🔹 Example Snippet (Python with requests):
Assignment 14: Test API Authentication with Headers
🔹 Task: Send an API request with authentication headers. 🔹 Example Snippet:
Assignment 15: Test PUT and DELETE Requests
🔹 Task: Update and delete a resource via API. 🔹 Example Snippet:
4️⃣ Writing pytest-Based API Tests (5 Assignments)
pytest-Based API Tests (5 Assignments)Assignment 16: Install pytest and Write a Simple Test
pytest and Write a Simple Test🔹 Task: Install pytest and create a test function.
🔹 Example Command:
🔹 Example Snippet (test_sample.py):
Run with:
Assignment 17: Write an API Test Using pytest
pytest🔹 Task: Verify a GET request returns a 200 status code.
🔹 Example Snippet (test_api.py):
Assignment 18: Test API Response Content
🔹 Task: Validate the response contains expected data. 🔹 Example Snippet:
Assignment 19: Test an API Using Parametrization
🔹 Task: Test multiple endpoints using pytest.mark.parametrize.
🔹 Example Snippet:
Assignment 20: Mock an API Response for Testing
🔹 Task: Use unittest.mock to simulate API responses.
🔹 Example Snippet:
Last updated