2-Day Selenium Automation with Python - Crash Course
Day 1: Selenium Basics + Practice
1. Setup & Installation
-----------------------
- Install Python: https://www.python.org/
- Install Selenium:
pip install selenium
- Download ChromeDriver (match your browser version):
https://chromedriver.chromium.org/downloads
2. Launch and Navigate
----------------------
Sample Code:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://www.google.com")
print(driver.title)
driver.quit()
3. Element Locators (ID, Name, XPath, CSS)
------------------------------------------
driver.find_element("name", "q").send_keys("Selenium Python")
Practice Sites:
- https://demoqa.com/
- https://the-internet.herokuapp.com/
4. Waits, Alerts, Frames
------------------------
from selenium.webdriver.common.by import By
2-Day Selenium Automation with Python - Crash Course
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
WebDriverWait(driver, 10).until(
EC.presence_of_element_located((By.ID, "username"))
Day 2: Advanced Concepts + Framework
1. Form Automation & Dropdowns
------------------------------
- Automate login forms, dropdowns, file uploads.
2. Screenshots & Headless Mode
------------------------------
driver.save_screenshot("screenshot.png")
from selenium.webdriver.chrome.options import Options
options = Options()
options.headless = True
driver = webdriver.Chrome(options=options)
3. Frameworks: Pytest + POM
---------------------------
- Learn basic pytest structure: tests/, pages/, conftest.py
- Use Page Object Model to reuse code
4. Final Practice Task
----------------------
- Login to demo site
2-Day Selenium Automation with Python - Crash Course
- Search product
- Add to cart
- Logout
Resources:
- Selenium Docs: https://selenium-python.readthedocs.io/
- Pytest Docs: https://docs.pytest.org/en/latest/