🟢 Selenium WebDriver

Learn Selenium WebDriver with Java, Python and TypeScript examples, locator strategies, waits, frames, real-world automation scenarios and interview questions.

Learn Selenium from scratch: installation, locators, actions, wait strategies, frames, real-world scenarios, and 50 interview questions. All examples in Java, Python, and TypeScript.

What you can learn on this page

  • 🟢 What is Selenium? How Does It Work? — Think of Selenium as a "robot assistant." You tell it "click this button, type this in that box." It opens the browser and does these things just like a human would. The difference: this assistant never gets tired, can do hundreds of action
  • ⚙️ Installation — Java, Python, TypeScript — Installation is simple: you already have Chrome. You need the driver (ChromeDriver) — it's the translator that lets Selenium talk to the browser. In Selenium 4, "Selenium Manager" handles this automatically. 1️⃣ Java Selenium Setup
  • 🎯 Locators — Element Finding Strategies — A locator is like an "address" for finding an element on the page. Just like a postal address: the more specific it is, the more accurately you find what you're looking for. The more unique a locator, the more reliable the test. Locator Types — Quick
  • ⚡ Actions — All User Interactions — Actions are everything a user can do in a browser: clicking, typing, scrolling, dragging, right-clicking. Selenium can do all of these with code — just like a human but much faster. 1. Basic Actions (Click, Type, Clear, Submit)
  • ⏳ Wait Strategies — Handling Timing Issues — Web pages don't load instantly — data comes from the server, JavaScript runs, animations complete. A "wait" strategy is Selenium patiently waiting instead of immediately failing. Like a car waiting at a red light and going when it turns green. Wait T
  • 🪟 Frames, Alerts & Multiple Windows — An iframe is like a mini page within a page — like a brochure inside a book. An alert is a browser warning that stops you. Multiple windows are like having several browser tabs open — Selenium needs to track which one it's on. 1. Alert / Confirm / Prompt
  • 🛠️ Real World — E-Commerce Test Scenario — Theory isn't enough — how is Selenium used in a real project? Let's test an e-commerce site end-to-end: user logs in, searches for a product, adds to cart, and checks out. Java — E2E Test with Page Object Model
  • 🔗 Ecosystem — TestNG, Maven, Jenkins, Grid — Selenium alone just controls the browser. A real project needs more: TestNG organizes tests (like JUnit), Maven manages dependencies (like Gradle), Jenkins runs them automatically (CI/CD), Grid runs them in parallel. TestNG Annotations