ScreenshotNeo

BlogGuides

What Is Selenium Used For? A Guide for Testers

Selenium automates real browsers for web application testing. Learn when to use WebDriver, IDE, Grid, and Selenium Manager, plus how to get started.

By the ScreenshotNeo team4 October 20269 min read

Selenium is used to automate web browsers, most often to test web applications by performing user-like actions and checking what the browser displays. Use WebDriver to write coded browser tests, Selenium IDE to record and replay browser actions, and Selenium Grid to run tests on remote machines or across browser and platform combinations. Selenium Manager can help set up the required browser driver in supported cases.

Selenium is a project of browser automation tools and libraries, not a complete test strategy or test runner. You still choose how to organize tests, make assertions, run them in CI, and decide which application behavior matters. The Selenium project describes WebDriver as using browser-vendor automation APIs to control browsers and run tests. Selenium documentation

What testers use Selenium for

Selenium drives a browser so a test can interact with a web application and inspect the result. Common uses include:

  • Functional checks: navigate through a flow, enter form data, submit it, and verify that the expected result appears.
  • Regression checks: rerun important browser workflows after application changes to catch behavior that has broken.
  • Cross-browser checks: run the same important scenarios in the browsers your application supports. Browser-specific capabilities and behavior can require browser-aware configuration.
  • Deployment checks: point a browser test at a local application or deployment candidate and exercise it as a user would.
  • Remote and distributed runs: send tests to Grid when you need remote browsers, multiple machines, or parallel sessions.
  • Recorded prototypes: use IDE to capture simple interactions and learn Selenium commands before building a coded suite.

Selenium controls the browser. It does not supply the application under test, a test runner, assertions, CI, or a plan for what to test. Those pieces come from the surrounding test setup.

Which Selenium component should you use?

Component Best fit How it works
WebDriver Coded browser tests and browser automation Your test code uses a language binding and the WebDriver interface to control a browser.
Selenium IDE Learning or recording straightforward interactions A browser extension records and replays actions. The official IDE page lists Chrome, Firefox, and Edge.
Selenium Grid Remote execution, browser matrices, and distributed or parallel runs Tests connect to remote browser instances across machines.
Selenium Manager Managing a missing driver, or selected browser releases, in supported setups It can discover, download, and cache drivers when a Selenium binding needs one and none was supplied.

These components have different jobs and can be combined. Start with WebDriver for a maintainable coded test suite. Try IDE for recorded exploration or simple cases. Add Grid when local sequential runs do not cover the browsers, platforms, or throughput you need. Selenium Manager assists setup; it does not replace a test runner or Grid.

For current browser-specific capabilities and compatibility, check the documentation for your target browser. Selenium’s browser documentation covers Chrome, Edge, Firefox, Internet Explorer, and Safari; that list is not a promise that every version or legacy driver is equally current. Supported browsers documentation

Get started with a local WebDriver test

A basic setup involves a language binding, a browser, and a driver for that browser. Selenium Manager, included with Selenium releases from version 4.6, can discover and manage drivers in supported cases. It is a fallback for supported configurations, not a guarantee that every custom browser installation or locked-down environment will be configured automatically. See the official getting-started guide and Selenium Manager documentation.

Python example

Install the Python binding, make a Chrome browser available, and save this as test_title.py. The example opens a page, checks its title, and quits the browser even if the check fails.

from selenium import webdriver


def main():
    driver = webdriver.Chrome()
    try:
        driver.get("https://example.com")
        assert driver.title == "Example Domain", driver.title
        print("Page title verified")
    finally:
        driver.quit()


if __name__ == "__main__":
    main()

Install and run it with:

python -m pip install selenium
python test_title.py

webdriver.Chrome() asks Selenium to start Chrome. Selenium Manager may obtain a compatible driver if one is missing and the environment permits it. If your setup requires a different browser or a preconfigured driver, use that browser’s Selenium binding and configuration.

JavaScript example

For Node.js, install Selenium’s JavaScript package and make Chrome available. Save the following as test-title.js:

const { Builder } = require('selenium-webdriver');

(async function main() {
  const driver = await new Builder().forBrowser('chrome').build();
  try {
    await driver.get('https://example.com');
    const title = await driver.getTitle();
    if (title !== 'Example Domain') {
      throw new Error(`Unexpected title: ${title}`);
    }
    console.log('Page title verified');
  } finally {
    await driver.quit();
  }
})();
npm install selenium-webdriver
node test-title.js

cURL is not a WebDriver test client

WebDriver is a browser automation protocol used by a test client to control a browser session. A plain cURL request fetches an HTTP response; it does not open and operate a browser like the examples above. cURL is useful for checking an ordinary endpoint, but it does not substitute for a browser test of rendered behavior.

When Selenium Grid is useful

Use Grid when tests need browser sessions on remote machines, coverage across multiple browsers or platforms, or more parallel execution than a single local browser can provide. A small suite that runs sequentially on one developer machine may not need Grid.

The Selenium Grid quick start lists Java 11 or higher, browsers, drivers (or Selenium Manager configuration), and the Selenium Server JAR as prerequisites for a basic local Grid. It uses http://localhost:4444 as the WebDriver endpoint. These are Grid server prerequisites; they are not required for every local WebDriver test. Follow the current Grid quick start for server setup.

Once a Grid is running, configure the test client to use its remote endpoint rather than starting a local browser. For example, in Python:

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

options = Options()
driver = webdriver.Remote(
    command_executor="http://localhost:4444",
    options=options,
)
try:
    driver.get("https://example.com")
    assert driver.title == "Example Domain"
finally:
    driver.quit()

Grid distributes browser execution; your test framework still owns test discovery, assertions, reporting, and retry policy. Before adopting a hosted browser service, compare the browser, OS, and device coverage you need, parallel capacity, CI integration, access to local or staging apps, debugging artifacts, and plan limits. BrowserStack documents Selenium integration and hosted execution capabilities in its Selenium Automate documentation; pricing and plan details are not covered here.

Test design and reliability

  • Test observable behavior. Assert what a user can see or do, such as a confirmation message, rather than relying on internal implementation details that change frequently.
  • Wait for conditions. Modern pages update asynchronously. Wait for a specific element or state before interacting or asserting; fixed sleeps can waste time and still race slower page changes.
  • Keep tests isolated. Give each test a known starting state and clean up browser sessions. The examples use finally so a failure does not leave the session running.
  • Use stable selectors. Prefer selectors tied to meaningful, stable attributes. Coordinate with application developers when tests need dedicated test identifiers.
  • Choose a representative browser matrix. Test the browsers your users and support policy require. Do not assume a passing run in one browser proves identical behavior everywhere.
  • Control external dependencies. A test can fail because of network, service, account, or test-data issues outside the browser automation itself. Make dependencies and test data repeatable where possible.

These are test-design practices, not guarantees supplied by Selenium. Reliability depends on the application, test data, environment, synchronization, and the surrounding runner.

Performance and cost considerations

Browser tests start real browser sessions, so runtime and resource use depend on the test flows, browser startup, page behavior, and execution environment. Avoid repeated setup that adds no coverage, and parallelize only when the machine or Grid has capacity. Too much concurrency can compete for CPU, memory, network, and shared test data.

Selenium itself is an open-source browser automation project; operating a test environment can still have costs in machine capacity, maintenance, CI time, or hosted browser execution. Grid can distribute runs but adds server and environment setup. A hosted service can reduce the need to maintain browser machines, while plan limits and access requirements should be checked with the provider. No universal runtime or cost benchmark applies across applications and environments.

Or skip the browser setup

If your goal is a screenshot of a page rather than an interactive test, ScreenshotNeo is a website screenshot API and MCP server from Yorker Media. One GET request returns a PNG, JPEG, WebP, or PDF. It is an alternative to try first when you need page captures without setting up browser automation. It does not replace Selenium for exercising and asserting interactive application behavior.

For example, this cURL request saves a WebP screenshot of Stripe. See the ScreenshotNeo API documentation for request options.

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

Equivalent 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)

Equivalent 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}`);
if (!res.ok) throw new Error(`Screenshot request failed: ${res.status}`);
await import('node:fs/promises').then(fs => fs.writeFile('shot.webp', Buffer.from(await res.arrayBuffer())));
  • Cookie banners are accepted like a visitor, and 60+ known consent platforms, newsletter popups, and chat widgets are removed before the shot; each step can be turned off.
  • Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing. Responses identify the page verdict and billing status in X-Page-Verdict and X-Billed headers.
  • An MCP server gives AI agents, including Claude, Cursor, and other MCP clients, the take_screenshot, get_page_info, and capture_pdf tools.
  • The free plan includes 1,000 screenshots a month with no card. Paid plans start at $5 for 3,000; yearly billing gives two months free, and every feature is on every plan.

Sign up for 1,000 free screenshots a month, with no card required.

Troubleshooting Selenium

Symptom Likely cause What to do
Driver executable or session cannot be created The browser and driver are missing, incompatible, or inaccessible; automatic management may be blocked or unsupported in the environment. Confirm the browser is installed and supported, check driver setup, and review Selenium Manager configuration. In restricted environments, provision the driver explicitly.
Browser starts locally but not in CI CI may lack a browser, required system dependencies, permissions, or a display configuration. Install and configure the browser for the CI image, inspect the runner logs, and follow the browser’s supported headless or display setup.
Element lookup returns no match The page may not have loaded the element yet, the selector may be wrong, or the element may be inside a frame. Verify the selector against the current page, wait for the expected condition, and switch into the relevant frame when needed.
Click or interaction is intercepted An overlay, animation, or another element may cover the target. Wait for the blocking state to clear, confirm the element is interactable, and investigate unexpected overlays instead of masking the failure with retries.
Test passes on one browser but fails on another Browser implementations, capabilities, timing, or application behavior can differ. Check the target browser’s Selenium documentation and inspect the failure in that browser. Keep browser-specific configuration explicit.
Remote session cannot connect to Grid The Grid server may not be running or reachable, or the client endpoint may be incorrect. Check the server status, port and network access, then confirm the remote URL matches the Grid endpoint. The quick-start endpoint is http://localhost:4444.
Tests are slow or flaky under parallel execution Sessions may compete for resources or share mutable test data. Reduce concurrency, allocate capacity, isolate data, and make waits depend on page state rather than arbitrary delays.

Frequently asked questions

Is Selenium only for testing?

No. WebDriver is a browser automation interface and can automate browser tasks beyond tests. This guide focuses on its common use for testing web applications.

Can Selenium test across browsers?

Yes. WebDriver tests can be configured for supported browsers, and Grid can run sessions remotely across browser and platform combinations. Check current browser-specific documentation for your targets.

Do I need Selenium Grid?

No. Grid is useful when remote execution, a browser matrix, or distributed throughput is needed. A small local test suite can run without it.

Does Selenium include assertions?

Selenium provides browser control. Assertions and test organization come from the language and test framework used around it.

Does Selenium Manager remove all driver setup?

It can manage drivers and selected browser releases in supported cases, but custom or restricted environments may still need explicit setup.

Sources and version notes

Software versions and browser support change. The research dossier recorded Selenium 4.49.0 as stable on September 9, 2026; check the official downloads page for the current release before following version-specific instructions.