Selenium with Java · Getting Started

What Is Selenium WebDriver?

Lesson 1 of 9 · 7 min read

Selenium is a free, open-source tool that controls a real web browser from code. You write a test that says "open this page, type here, click that button, check this text", and Selenium does it in Chrome, Firefox, Edge or Safari exactly like a user would.

The parts of Selenium

PartWhat it does
WebDriverThe library you use in code to drive the browser. This is what testers mean when they say "Selenium".
Selenium GridRuns many tests at the same time on different machines and browsers.
Selenium IDEA browser extension that records clicks and plays them back. Good for a quick demo, not for a real test suite.

How WebDriver talks to the browser

  1. Your Java test calls a WebDriver method, for example driver.findElement(...).click().
  2. WebDriver sends that command over HTTP to a browser driver (chromedriver for Chrome, geckodriver for Firefox).
  3. The browser driver tells the real browser to do the action and sends back the result.

Since Selenium 4.6, Selenium Manager downloads the right browser driver for you. You no longer have to download chromedriver by hand.

When Selenium is a good choice

  • The team already uses Java, C# or Python.
  • You need many browsers, including older ones, or a Selenium Grid / cloud provider.
  • The job you want asks for it. Selenium with Java is still the most requested automation skill in QA job posts.

Newer tools like Playwright and Cypress have built-in waiting and faster setup. The concepts you learn here (locators, waits, page objects) carry over to all of them. See Playwright vs Selenium for a full comparison.

What to automate (and what not to)

  • Automate: regression tests you run every release, smoke tests, data-heavy checks, flows on many browsers.
  • Keep manual: one-off checks, exploratory testing, look and feel, features that still change every day.
Next: in the next lesson you set up Java, Maven and Selenium and get a browser to open.
All 9 lessons in Selenium with Java
  1. What Is Selenium WebDriver?
  2. Set Up Java, Maven and Selenium
  3. Write Your First Selenium Test
  4. Selenium Locators: ID, CSS, XPath and More
  5. Clicks, Typing, Dropdowns, Alerts, Frames and Windows
  6. Waits in Selenium: Implicit, Explicit and Fluent
  7. TestNG for Selenium: Annotations, Assertions and Data
  8. Page Object Model in Selenium Java
  9. Selenium Framework Structure, Reports and CI