Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Selenium is an umbrella project for automating web browsers in software tests. It is not one test runner: WebDriver gives code a language-neutral way to control a browser, Selenium IDE records and replays interactions, and Selenium Grid runs sessions remotely across machines and browser/operating-system combinations. Choose the component that matches the job, then verify browser-specific behavior in the current Selenium and browser documentation.

What is Selenium in software testing?

The Selenium Project describes Selenium as “an umbrella project for a range of tools and libraries that enable and support the automation of web browsers.” In testing, that means your test can open a real browser, navigate to a URL, locate elements, enter data, click controls, check page state, and report failures.

Selenium automates browser-based applications rather than testing server code directly. A complete test suite normally combines Selenium with a programming language, a test framework, assertions, test data, reporting, and a CI system. Selenium supplies the browser-control layer.

Which Selenium component should you use?

Need Component What it provides
Maintain coded tests WebDriver Programmatic browser control through language bindings and browser drivers.
Record a quick interaction Selenium IDE Browser extension-based recording and replay for exploratory work and simple checks.
Run remotely or in parallel Selenium Grid Remote WebDriver sessions distributed across machines and environments.

WebDriver for durable automation

WebDriver is the usual choice for a maintainable regression suite. Your Python, Java, JavaScript, C#, Ruby, or other supported-language code calls the Selenium binding. The binding speaks the WebDriver protocol to a browser-specific driver, which communicates with the browser. WebDriver is a W3C Recommendation, so the interface is standardized even though capabilities and behavior can differ by browser.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

IDE for recording and exploration

Selenium IDE can record clicks, navigation, and form entry, then replay them. It is useful for learning a workflow, reproducing a bug, or creating a quick smoke check. Recorded locators and timing often need review before a test becomes a dependable, long-lived suite; use WebDriver code when you need reusable fixtures, branching logic, data-driven tests, or detailed integration with your test framework.

Grid for remote and distributed sessions

Grid is the execution component, not a replacement for WebDriver code. A test requests a browser and platform, and Grid routes the session to an available node. This is useful when one developer machine cannot represent the browsers and operating systems you support, or when parallel sessions reduce wall-clock time. Capacity planning depends on browser/OS combinations, concurrent sessions, machines, CPU, and RAM.

How Selenium WebDriver works

  1. Your test calls a language binding such as Selenium’s Python package.
  2. The binding creates a WebDriver session and sends commands using the WebDriver protocol.
  3. A browser-specific driver implementation handles communication with Chrome, Edge, Firefox, Safari, or another supported browser.
  4. The browser performs navigation and interaction, while responses, element data, screenshots, and errors return to the test.

WebDriver BiDi is the newer bidirectional protocol direction developed with browser vendors. It adds a WebSocket connection so scripts can react to browser events, rather than only issuing request-and-response commands. Treat BiDi support as capability- and browser-dependent; consult the current browser support pages before designing around a particular event.

What you need to install

  • A supported programming-language binding, installed with that language’s package manager.
  • The browser you intend to test.
  • A matching browser-driver setup. Selenium Manager can configure drivers automatically in supported Selenium startup paths, but confirm the behavior for your language and environment.
  • A test runner and assertion library, such as the runner commonly used in your language.
  • Optional: a Grid server or hosted remote browser service for remote and parallel execution.

Selenium’s supported-browser documentation has separate guidance for Chrome, Edge, Firefox, Internet Explorer, and Safari. Do not assume identical features, options, or versions across browsers. Pin versions in CI where reproducibility matters, and re-check driver and browser compatibility after upgrades.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A minimal Python WebDriver test

Install Selenium with pip install selenium, ensure a browser is available, and save this as test_title.py:

from selenium import webdriver
from selenium.webdriver.common.by import By


def test_homepage_title():
    driver = webdriver.Chrome()
    try:
        driver.get("https://example.com")
        assert "Example Domain" in driver.title
        heading = driver.find_element(By.TAG_NAME, "h1")
        assert heading.is_displayed()
    finally:
        driver.quit()

Run it with your test runner, for example pytest test_title.py. The finally block matters: it closes the session even when an assertion fails. In real applications, prefer stable IDs or deliberate data attributes over brittle absolute XPath expressions, and wait for a condition instead of inserting arbitrary sleeps.

Explicit waits

from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

button = WebDriverWait(driver, 15).until(
    EC.element_to_be_clickable((By.CSS_SELECTOR, "button[data-test='checkout']"))
)
button.click()

Explicit waits make the synchronization rule visible: the test proceeds when the required state exists or fails after the chosen timeout.

Running tests on Selenium Grid

Start with the current Selenium Grid quick-start instructions, then point your test at the Grid URL instead of constructing a local driver. A remote test typically supplies browser capabilities and a command executor. Grid can be standalone for a simple remote endpoint or distributed into router, distributor, session-map, and node roles for larger installations.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Grid guide estimates around 1 GB of RAM per browser session for planning. This is an estimate, not a universal requirement: heavy pages, video, extensions, headless mode, operating-system overhead, and your test behavior can change consumption. Measure your workload, leave headroom, and limit concurrency when nodes become CPU- or memory-bound.

When Grid is justified

  • You must test several browser and operating-system combinations.
  • You need more parallel sessions than one workstation can safely run.
  • Your CI workers are separate from the machines that host browsers.
  • You require a central remote endpoint and session scheduling.

If you only need one browser on one developer machine, local WebDriver is simpler. Hosted execution can remove infrastructure maintenance; Selenium IDE’s runner documentation names Sauce Labs as an example provider, but provider features, pricing, and terms must be checked directly before selection.

Reliable Selenium test design

Locators and page changes

Use semantic, stable locators and keep them in page-object or component abstractions. Avoid coupling every test to layout classes that designers may change. When a control is inside an iframe, switch to the frame before locating it; switch back to the default content afterward. For new windows or tabs, wait for the additional window handle and switch explicitly.

State, data, and cleanup

Give each test controlled data and an isolated account or database state where possible. Clear cookies or create a fresh session when isolation requires it. Always quit the driver in teardown. Capture the URL, browser capabilities, console information where supported, and a screenshot on failure so a CI failure is diagnosable.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Headless and visual differences

Headless execution is convenient for CI but can expose viewport, font, GPU, download, and permission differences. Set the window size deliberately and run a representative headed job when visual behavior matters. Test responsive layouts with explicit viewport sizes rather than assuming the CI default.

Troubleshooting common failures

<

Symptom Likely cause Fix
Driver or session creation error Browser-driver incompatibility or unavailable binary. Check the browser support page, update compatible versions, or let Selenium Manager resolve the driver where supported.
Element not found Wrong locator, iframe, shadow DOM, or page not ready. Inspect the DOM, switch context, use a stable locator, and add an explicit wait for the required state.
Element is not interactable Overlay, animation, off-screen element, or disabled control. Wait for visibility and clickability, dismiss the overlay deliberately, and verify the element’s enabled state.
Tests pass locally but fail in CI Different browser version, viewport, timezone, data, speed, or permissions. Log capabilities, pin or document versions, set environment values explicitly, and remove order dependence.
Grid queues or rejects sessions No node matches capabilities or resources are exhausted. Check requested browser/platform names, node availability, concurrency limits, CPU, and RAM.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Performance, reliability, and maintenance trade-offs

Parallelism can reduce elapsed suite time, but each session consumes infrastructure and increases contention. Start with a small concurrency level, observe CPU and memory, then raise it gradually. Reusing a browser can be faster but risks state leakage; fresh sessions improve isolation at the cost of startup time. Avoid retries that conceal deterministic defects. Retry only failures known to be environmental, and record every retry.

Browser releases, drivers, Selenium bindings, and protocol capabilities change. Review the official Selenium browser-support pages and release documentation as part of dependency maintenance. WebDriver standardization improves portability, not perfect behavioral identity: keep browser-specific tests for features whose implementation differs.

Or skip the browser setup

For a single static capture, you may not need to maintain Selenium at all. ScreenshotNeo is a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF, while its capture flow accepts cookie banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets before the shot. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

cURL (see the ScreenshotNeo documentation):

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Python:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)

Node.js:

const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo also provides an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Every plan includes its features; 1,000 screenshots per month are free with no card, and paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.

Frequently Asked Questions

Is Selenium a programming language?

No. Selenium provides browser-automation tools and language bindings; you write tests in a language such as Python, Java, JavaScript, C#, or Ruby.

Can Selenium test mobile apps?

Selenium targets web browsers. Native and hybrid mobile-app automation requires a mobile-focused tool; a mobile browser may be tested only when the chosen WebDriver environment supports it.

Does Selenium replace unit tests?

No. Browser tests cover end-to-end behavior and should complement faster unit and service-level tests.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.