Previous

Introduction to Automation & Selenium (with Python)

Next

What is Software Testing?

  • Importance of testing in SDLC

  • Manual vs Automation Testing

  • Functional, Regression, Integration Testing

  • Role of QA in Agile/DevOps


What is Automation Testing?

  • Automating repetitive test cases

  • Benefits: Faster feedback, better coverage, reduced manual effort

  • Where automation fits in the testing pyramid


Manual vs Automation Testing

Feature Manual Testing Automation Testing
Speed Slower Faster
Accuracy Human-prone errors Precise
Initial Cost Lower Higher
Maintenance Easy Requires updates
Suitability Exploratory, UI Regression, Load

Why Selenium with Python?

  • Open-source & cross-platform

  • Supports all browsers: Chrome, Firefox, Edge, Safari

  • Easy syntax and scripting using Python

  • Integration with PyTest, Jenkins, Allure, Docker

  • Large community and job opportunities


Evolution of Selenium

  • Selenium Core → RC → WebDriver → Selenium 4

  • Selenium 4 supports modern browsers using W3C WebDriver protocol


Selenium Tool Suite

Tool Purpose
Selenium IDE Record & playback (not Python-based)
Selenium RC Deprecated
Selenium WebDriver Browser automation (used with Python)
Selenium Grid Parallel and cross-browser execution

Selenium Architecture with Python

  • Test Script (Python) → Selenium Bindings → Browser Driver → Actual Browser

  • Browser drivers: ChromeDriver, GeckoDriver, EdgeDriver, etc.


Environment Setup (Step-by-Step)

  1. Install Python 3
    https://www.python.org/downloads/

  2. Install Selenium via pip

    pip install selenium
    
  3. Download WebDriver for your browser
    e.g., https://chromedriver.chromium.org/downloads

  4. Set PATH or provide executable path manually


Your First Selenium Script in Python

from selenium import webdriver

# Setup Chrome browser
driver = webdriver.Chrome()  # Add executable_path if not in PATH

# Open a webpage
driver.get("https://www.google.com")

# Print the page title
print("Page Title:", driver.title)

# Close the browser
driver.quit()