llms.txt
Compare with other sites' llms.txt files →# Selenium
> Selenium automates browsers. That's it!
Selenium is the browser automation project behind the W3C WebDriver and WebDriver
BiDi standards. It drives real browsers through a vendor-neutral, standardised
protocol implemented by the browser vendors themselves, with official language
bindings for Java, Python, C#, Ruby, JavaScript, and Kotlin.
Notes for tools generating Selenium code from this documentation:
- Selenium 4.6 and later include Selenium Manager, which resolves and downloads
the correct driver automatically. Do not set driver executable paths and do not
use third-party driver managers.
- Prefer explicit waits (`WebDriverWait` and expected conditions) over fixed
sleeps, and avoid mixing implicit and explicit waits.
- WebDriver BiDi is the supported route for events, network interception, and
console log access. The Chrome DevTools Protocol integration is legacy.
- Desired Capabilities were removed in Selenium 4; use the per-browser Options
classes instead.
- Code samples on this site are compiled and tested in CI from the examples in
https://github.com/SeleniumHQ/seleniumhq.github.io/tree/trunk/examples
- Every documentation page has a Markdown version, with the code examples for
each language inline: add `index.md` to the page URL, for example
https://www.selenium.dev/documentation/webdriver/waits/index.md
## AI agents and code generation (high priority)
Read these first if you are a tool generating Selenium code. They list the Selenium 2 and 3 era patterns that models reproduce from old training data, such as DesiredCapabilities, manual driver downloads, fixed sleeps, absolute XPath, and find_element_by_* methods, together with their current replacements.
- [Using AI coding agents with Selenium](https://www.selenium.dev/documentation/ai_agents/index.md): How to get coding agents and large language models to write Selenium code that is current, correct, and not flaky.
- [Outdated Selenium patterns and their current replacements](https://www.selenium.dev/documentation/ai_agents/outdated_patterns/index.md): Selenium 2 and 3 idioms that coding agents and old tutorials still produce, with the current form of each.
## Getting started
Install, write, and run a first script in any supported language.
- [The Selenium Browser Automation Project](https://www.selenium.dev/documentation/index.md)
- [WebDriver](https://www.selenium.dev/documentation/webdriver/index.md): WebDriver drives a browser natively; learn more about it.
- [Getting started](https://www.selenium.dev/documentation/webdriver/getting_started/index.md): Install Selenium, write your first script, and run it.
## Guides
Task-based guides, organised by the problem at hand, each linking into the reference pages below.
- [Guides](https://www.selenium.dev/documentation/guides/index.md): Task-based guides: start from the problem you have and follow the links into the reference pages that solve it.
- [Waiting for things to happen](https://www.selenium.dev/documentation/guides/waiting/index.md): Synchronising your code with the page using explicit waits and expected conditions, and why a fixed sleep is the wrong tool.
- [Finding elements reliably](https://www.selenium.dev/documentation/guides/finding_elements/index.md): Choosing a locator strategy that survives the next release of the application, and avoiding the ones that do not.
- [Authentication and sessions](https://www.selenium.dev/documentation/guides/authentication/index.md): Getting past a login once, answering HTTP basic authentication prompts, and reusing a signed-in state across tests without driving the login form every time.
- [Files: upload and download](https://www.selenium.dev/documentation/guides/files/index.md): Uploading a file through a form without touching the operating system's file dialog, and why downloading through the browser is not the right way to test a download.
- [Dialogs and alerts](https://www.selenium.dev/documentation/guides/dialogs/index.md): Reading, accepting, dismissing and typing into JavaScript alerts, confirms and prompts, and deciding what should happen to a dialog your test did not expect.
- [Frames and windows](https://www.selenium.dev/documentation/guides/frames_and_windows/index.md): Reaching elements inside an iframe, following a link that opens a new tab or window, and getting back to where you started.
- [Screenshots and PDFs](https://www.selenium.dev/documentation/guides/screenshots/index.md): Capturing the viewport, a single element or the whole page as an image, and printing a page to PDF.
- [Network interception and mocking](https://www.selenium.dev/documentation/guides/network/index.md): Watching the requests a page makes, blocking or failing some of them, and answering authentication challenges, using the W3C WebDriver BiDi network module.
- [Console and logs](https://www.selenium.dev/documentation/guides/logging/index.md): Capturing the browser's console output and JavaScript errors with BiDi, and turning up Selenium's own logging to see what the bindings and the driver are doing.
- [Running in CI](https://www.selenium.dev/documentation/guides/ci/index.md): Running a Selenium suite on a build server: headless browsers, driver management without manual downloads, and when to move to Grid or Docker.
- [Running in Docker and Grid](https://www.selenium.dev/documentation/guides/docker_and_grid/index.md): Moving the browser off the machine that runs the tests, with Selenium Grid and the project's Docker images, so a suite can run in parallel and against several browsers.
- [Debugging a failing test](https://www.selenium.dev/documentation/guides/debugging/index.md): A short procedure for working out why a Selenium test failed: read the exception, gather evidence, and narrow the cause before changing anything.
- [Migrating from Selenium 3](https://www.selenium.dev/documentation/guides/migrating_from_selenium_3/index.md): What changes when a Selenium 3 suite moves to Selenium 4, and where to find the step-by-step upgrade guide.
## Driver sessions and browsers
Starting sessions, configuring browsers, and running remotely.
- [Driver Sessions](https://www.selenium.dev/documentation/webdriver/drivers/index.md)
- [Browser Options](https://www.selenium.dev/documentation/webdriver/drivers/options/index.md): These capabilities are shared by all browsers.
- [HTTP Client Configuration](https://www.selenium.dev/documentation/webdriver/drivers/http_client/index.md)
- [Driver Service Class](https://www.selenium.dev/documentation/webdriver/drivers/service/index.md)
- [Remote WebDriver](https://www.selenium.dev/documentation/webdriver/drivers/remote_webdriver/index.md)
- [Supported Browsers](https://www.selenium.dev/documentation/webdriver/browsers/index.md)
- [Chrome specific functionality](https://www.selenium.dev/documentation/webdriver/browsers/chrome/index.md): These are capabilities and features specific to Google Chrome browsers.
- [Edge specific functionality](https://www.selenium.dev/documentation/webdriver/browsers/edge/index.md): These are capabilities and features specific to Microsoft Edge browsers.
- [Firefox specific functionality](https://www.selenium.dev/documentation/webdriver/browsers/firefox/index.md): These are capabilities and features specific to Mozilla Firefox browsers.
- [IE specific functionality](https://www.selenium.dev/documentation/webdriver/browsers/internet_explorer/index.md): These are capabilities and features specific to Microsoft Internet Explorer browsers.
- [Safari specific functionality](https://www.selenium.dev/documentation/webdriver/browsers/safari/index.md): These are capabilities and features specific to Apple Safari browsers.
## Elements and interactions
Locating elements, interacting with them, and driving the browser.
- [Web elements](https://www.selenium.dev/documentation/webdriver/elements/index.md): Identifying and working with element objects in the DOM.
- [Locator strategies](https://www.selenium.dev/documentation/webdriver/elements/locators/index.md): Ways to identify one or more specific elements in the DOM.
- [Finding web elements](https://www.selenium.dev/documentation/webdriver/elements/finders/index.md): Locating the elements based on the provided locator values.
- [Interacting with web elements](https://www.selenium.dev/documentation/webdriver/elements/interactions/index.md): A high-level instruction set for manipulating form controls.
- [Information about web elements](https://www.selenium.dev/documentation/webdriver/elements/information/index.md): What you can learn about an element.
- [File Upload](https://www.selenium.dev/documentation/webdriver/elements/file_upload/index.md)
- [Browser interactions](https://www.selenium.dev/documentation/webdriver/interactions/index.md)
- [Browser navigation](https://www.selenium.dev/documentation/webdriver/interactions/navigation/index.md)
- [JavaScript alerts, prompts and confirmations](https://www.selenium.dev/documentation/webdriver/interactions/alerts/index.md)
- [Working with cookies](https://www.selenium.dev/documentation/webdriver/interactions/cookies/index.md)
- [Working with IFrames and frames](https://www.selenium.dev/documentation/webdriver/interactions/frames/index.md)
- [Print Page](https://www.selenium.dev/documentation/webdriver/interactions/print_page/index.md)
- [Working with windows and tabs](https://www.selenium.dev/documentation/webdriver/interactions/windows/index.md)
- [Virtual Authenticator](https://www.selenium.dev/documentation/webdriver/interactions/virtual_authenticator/index.md): A representation of the Web Authenticator model.
- [Actions API](https://www.selenium.dev/documentation/webdriver/actions_api/index.md): A low-level interface for providing virtualized device input actions to the web browser.
- [Keyboard actions](https://www.selenium.dev/documentation/webdriver/actions_api/keyboard/index.md): A representation of any key input device for interacting with a web page.
- [Mouse actions](https://www.selenium.dev/documentation/webdriver/actions_api/mouse/index.md): A representation of any pointer device for interacting with a web page.
- [Pen actions](https://www.selenium.dev/documentation/webdriver/actions_api/pen/index.md): A representation of a pen stylus kind of pointer input for interacting with a web page.
- [Scroll wheel actions](https://www.selenium.dev/documentation/webdriver/actions_api/wheel/index.md): A representation of a scroll wheel input device for interacting with a web page.
- [Support features](https://www.selenium.dev/documentation/webdriver/support_features/index.md): Support classes provide optional higher level features.
- [Waiting with Expected Conditions](https://www.selenium.dev/documentation/webdriver/support_features/expected_conditions/index.md): These are classes used to describe what needs to be waited for.
- [Command Listeners](https://www.selenium.dev/documentation/webdriver/support_features/listeners/index.md)
- [Working With Colors](https://www.selenium.dev/documentation/webdriver/support_features/colors/index.md)
- [Working with select list elements](https://www.selenium.dev/documentation/webdriver/support_features/select_lists/index.md): Select lists have special behaviors compared to other elements.
- [ThreadGuard](https://www.selenium.dev/documentation/webdriver/support_features/thread_guard/index.md)
## Waiting
Prefer explicit waits over fixed sleeps, and do not mix implicit and explicit waits.
- [Waiting Strategies](https://www.selenium.dev/documentation/webdriver/waits/index.md)
## WebDriver BiDi
The W3C bidirectional protocol: events, network interception, console logs, and script injection. This is the current answer to anything that needs bidirectional browser communication. The older Chrome DevTools Protocol integration is legacy and is being removed; it is not listed here.
- [WebDriver BiDi](https://www.selenium.dev/documentation/webdriver/bidi/index.md): WebDriver BiDi is the W3C standard bidirectional protocol for browser automation, created by the Selenium project together with the browser vendors. It adds a WebSocket connection to WebDriver so scripts can stream and react to browser events — network requests, console messages, JavaScript errors — and it is the cross-browser replacement for the Chrome DevTools Protocol.
- [WebDriver BiDi Logging Features](https://www.selenium.dev/documentation/webdriver/bidi/logging/index.md): These features are related to logging. Because "logging" can refer to so many different things, these methods are made available via a "script" namespace.
- [WebDriver BiDi Network Features](https://www.selenium.dev/documentation/webdriver/bidi/network/index.md): These features are related to networking, and are made available via a "network" namespace.
- [WebDriver BiDi Script Features](https://www.selenium.dev/documentation/webdriver/bidi/script/index.md): These features are related to scripts, and are made available via a "script" namespace.
- [BiDirectional API (W3C compliant)](https://www.selenium.dev/documentation/webdriver/bidi/w3c/index.md): Examples of working with the W3C WebDriver BiDi protocol in Selenium — the standard, cross-browser replacement for the Chrome DevTools Protocol. These APIs stream events from the browser over a WebSocket, for network interception, console logs, and browser event handling.
- [Browsing Context](https://www.selenium.dev/documentation/webdriver/bidi/w3c/browsing_context/index.md)
- [Input](https://www.selenium.dev/documentation/webdriver/bidi/w3c/input/index.md)
- [Log](https://www.selenium.dev/documentation/webdriver/bidi/w3c/log/index.md)
- [Network](https://www.selenium.dev/documentation/webdriver/bidi/w3c/network/index.md)
- [Script](https://www.selenium.dev/documentation/webdriver/bidi/w3c/script/index.md)
## Driver management
Selenium Manager ships with Selenium 4.6 and later and downloads and configures browser drivers automatically. Third-party driver managers and manual driver paths are not required.
- [Selenium Manager](https://www.selenium.dev/documentation/selenium_manager/index.md): Selenium Manager is a command-line tool implemented in Rust that provides automated driver and browser management for Selenium. Selenium bindings use this tool by default, so you do not need to download it or add anything to your code or do anything else to use it.
## Grid
Running tests remotely and at scale.
- [Grid](https://www.selenium.dev/documentation/grid/index.md): Want to run tests in parallel across multiple machines? Then, Grid is for you.
- [Getting started with Selenium Grid](https://www.selenium.dev/documentation/grid/getting_started/index.md): Instructions for a simple Selenium Grid
- [When to Use Grid](https://www.selenium.dev/documentation/grid/applicability/index.md): Is Grid right for you?
- [Selenium Grid Components](https://www.selenium.dev/documentation/grid/components/index.md): Understand how to use the different Grid components
- [Grid architecture](https://www.selenium.dev/documentation/grid/architecture/index.md)
- [Configuration of Components](https://www.selenium.dev/documentation/grid/configuration/index.md): Here you can see how each Grid component can be configured individually based on common configuration values and component-specific configuration values.
- [Configuration help](https://www.selenium.dev/documentation/grid/configuration/help/index.md): Get information about all the available options to configure Grid.
- [CLI options in the Selenium Grid](https://www.selenium.dev/documentation/grid/configuration/cli_options/index.md): All Grid components configuration CLI options in detail.
- [TOML configuration options](https://www.selenium.dev/documentation/grid/configuration/toml_options/index.md): Grid configuration examples using Toml files.
- [Advanced features of Selenium](https://www.selenium.dev/documentation/grid/advanced_features/index.md): To get all the details of the advanced features, understand how it works, and how to set up your own, please browse thorough the following sections.
- [Observability in Selenium Grid](https://www.selenium.dev/documentation/grid/advanced_features/observability/index.md)
- [GraphQL query support](https://www.selenium.dev/documentation/grid/advanced_features/graphql_support/index.md)
- [Grid endpoints](https://www.selenium.dev/documentation/grid/advanced_features/endpoints/index.md)
- [Customizing a Node](https://www.selenium.dev/documentation/grid/advanced_features/customize_node/index.md)
- [External datastore](https://www.selenium.dev/documentation/grid/advanced_features/external_datastore/index.md)
## Test practices
Encouraged and discouraged patterns, including the causes of flaky tests.
- [Test Practices](https://www.selenium.dev/documentation/test_practices/index.md): Some guidelines and recommendations on testing from the Selenium project.
- [Design patterns and development strategies](https://www.selenium.dev/documentation/test_practices/design_strategies/index.md)
- [Overview of Test Automation](https://www.selenium.dev/documentation/test_practices/overview/index.md)
- [Types of Testing](https://www.selenium.dev/documentation/test_practices/testing_types/index.md)
- [Encouraged behaviors](https://www.selenium.dev/documentation/test_practices/encouraged/index.md): Some guidelines and recommendations on testing from the Selenium project.
- [Page object models](https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/index.md)
- [Domain specific language](https://www.selenium.dev/documentation/test_practices/encouraged/domain_specific_language/index.md)
- [Generating application state](https://www.selenium.dev/documentation/test_practices/encouraged/generating_application_state/index.md)
- [Mock external services](https://www.selenium.dev/documentation/test_practices/encouraged/mock_external_services/index.md)
- [Improved reporting](https://www.selenium.dev/documentation/test_practices/encouraged/improved_reporting/index.md)
- [Avoid sharing state](https://www.selenium.dev/documentation/test_practices/encouraged/avoid_sharing_state/index.md)
- [Tips on working with locators](https://www.selenium.dev/documentation/test_practices/encouraged/locators/index.md): When to use which locators and how best to manage them in your code.
- [Test independency](https://www.selenium.dev/documentation/test_practices/encouraged/test_independency/index.md)
- [Consider using a fluent API](https://www.selenium.dev/documentation/test_practices/encouraged/consider_using_a_fluent_api/index.md)
- [Fresh browser per test](https://www.selenium.dev/documentation/test_practices/encouraged/fresh_browser_per_test/index.md)
- [Discouraged behaviors](https://www.selenium.dev/documentation/test_practices/discouraged/index.md): Things to avoid when automating browsers with Selenium.
- [Captchas](https://www.selenium.dev/documentation/test_practices/discouraged/captchas/index.md)
- [File downloads](https://www.selenium.dev/documentation/test_practices/discouraged/file_downloads/index.md)
- [HTTP response codes](https://www.selenium.dev/documentation/test_practices/discouraged/http_response_codes/index.md)
- [Gmail, email and Facebook logins](https://www.selenium.dev/documentation/test_practices/discouraged/gmail_email_and_facebook_logins/index.md)
- [Test dependency](https://www.selenium.dev/documentation/test_practices/discouraged/test_dependency/index.md)
- [Performance testing](https://www.selenium.dev/documentation/test_practices/discouraged/performance_testing/index.md)
- [Link spidering](https://www.selenium.dev/documentation/test_practices/discouraged/link_spidering/index.md)
- [Two Factor Authentication](https://www.selenium.dev/documentation/test_practices/discouraged/two_factor_authentication/index.md)
## Troubleshooting
Common errors, upgrade guidance, and logging.
- [Troubleshooting Assistance](https://www.selenium.dev/documentation/webdriver/troubleshooting/index.md): How to solve WebDriver p