Scrapeless Wiki

What Is Selenium? – Definition and How It Works

Informational P1 what is selenium

Learn what Selenium is, how WebDriver works as a standard, which languages and browsers it covers, and where it still fits alongside newer tools.

Selenium is the oldest widely used browser automation project, and the one whose interface became a web standard. Its central idea is that a script talks to a driver, and the driver talks to a browser.

1. What Is Selenium?

Selenium automates real browsers through the WebDriver protocol.

  • Key idea: a standardised, browser-agnostic control interface rather than a per-browser API.
  • Mechanism: the script sends WebDriver commands to a driver process, which translates them for its browser.
  • Goal: run the same test against any browser that ships a compliant driver.

Example

driver.get("https://example.com")
element = driver.find_element(By.CSS_SELECTOR, "h1")
print(element.text)
driver.quit()

2. WebDriver as a Standard

WebDriver is a W3C specification, not a single vendor's API. Browser makers ship their own drivers implementing it, which is why Selenium's browser coverage is broad and why its command set is conservative β€” changes go through standardisation.

That standardisation is Selenium's durability and also its pace. Capabilities appear once specified rather than as soon as one engine supports them.

3. What It Covers

Dimension Coverage
Browsers Chrome, Firefox, Edge, Safari, and others with compliant drivers
Languages Java, Python, C#, Ruby, JavaScript, and community bindings
Distribution Selenium Grid runs sessions across many machines
Scope Browser control; assertions and runners come from your test framework

4. Waiting Is Explicit

Selenium does not wait for elements to become actionable unless told to. Reliable scripts use explicit waits on a condition:

WebDriverWait(driver, 10).until(
    EC.presence_of_element_located((By.CSS_SELECTOR, "h1"))
)

Scripts that use fixed sleeps instead are the classic source of flaky Selenium suites. The pattern is well understood; it is simply not automatic.

5. Where Selenium Still Fits

  • Existing suites. Large, working test estates have no reason to migrate.
  • Language coverage. Mature bindings exist for languages other tools do not target.
  • Grid infrastructure. Established distributed execution across browsers and machines.
  • Standards alignment. Teams that prefer a specified protocol over a vendor library.

6. Where Newer Tools Pull Ahead

Auto-waiting, network interception, browser contexts, tracing, and a bundled test runner are conveniences that later libraries ship by default. Achieving the same in Selenium means assembling them from your own code and other libraries.

The decision is usually about whether those conveniences outweigh an existing investment, not about capability in the abstract.

7. Common Misconceptions

  • "Selenium is obsolete." It is standardised, maintained, and widely deployed. It is less batteries-included, which is a different claim.
  • "It cannot be used for scraping." It can, subject to the same cost trade-off as any browser: use it when the browser is genuinely required.
  • "WebDriver and CDP are the same." WebDriver is a standard protocol; CDP is Chromium's own, lower-level interface. Some Selenium versions can reach CDP directly, which is browser-specific.
  • "Grid is required." It solves distribution. A single machine runs Selenium perfectly well.

8. Summary

Selenium drives browsers through the standardised WebDriver protocol, with the widest language and browser coverage of any automation project and a mature story for distributed execution.

Its trade-off is explicitness: waits, interception, and test infrastructure are yours to assemble. That suits established suites and standards-minded teams, while greenfield projects often prefer a library that ships those pieces already wired together.