Selenium WebDriver Complete Guide 2026
The complete 2026 Selenium WebDriver guide — install, first test, locators, waits, Selenium 4 features (relative locators, BiDi, Grid 4), framework design, and CI.

Last updated 2026-07-20 · 18 min read · By Avinash Kamble, reviewed by Priyanka G.
Selenium is still the most-installed test tool on Earth in 2026, powering the majority of enterprise regression suites. Selenium 4 modernized the API — relative locators, native BiDi protocol, container-first Grid — while keeping backward compatibility. This guide gets you productive fast.
1. Install and first test in 5 minutes
// Maven
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>4.24.0</version>
</dependency>
WebDriver driver = new ChromeDriver();
driver.get("https://softwaretestpilot.com");
driver.findElement(By.linkText("Jobs")).click();
driver.quit();Selenium Manager (built-in since 4.11) auto-downloads the right driver binary — no more WebDriverManager for most cases.
2. Locators — including Selenium 4 relative locators
// Classic
driver.findElement(By.id("email"));
driver.findElement(By.cssSelector("button[data-testid='submit']"));
// Selenium 4 — relative locators
import static org.openqa.selenium.support.locators.RelativeLocator.with;
WebElement password = driver.findElement(with(By.tagName("input")).below(By.id("email")));3. Waits — never use Thread.sleep
// ✅ Explicit wait
new WebDriverWait(driver, Duration.ofSeconds(10))
.until(ExpectedConditions.elementToBeClickable(By.id("submit")));
// ❌ Never
Thread.sleep(3000);4. Selenium 4 features you should use in 2026
- BiDi protocol — subscribe to console logs, network events, JS errors.
- Relative locators —
above,below,toLeftOf,toRightOf,near. - New Grid 4 — Docker-first, observable via OpenTelemetry.
- Chrome DevTools Protocol — throttle network, emulate geolocation.
The official Selenium WebDriver docs stay the canonical reference.
5. Framework design — POM + TestNG
Reference structure:
src/test/java/
pages/ ← Page Objects
tests/ ← @Test classes
base/ ← BaseTest with driver setup
utils/ ← waits, data helpers
testng.xmlDeeper: Java for Selenium.
6. Selenium Grid 4 in Docker
docker network create grid
docker run -d --net grid --name selenium-hub selenium/hub:4.24
docker run -d --net grid -e SE_EVENT_BUS_HOST=selenium-hub \
-e SE_EVENT_BUS_PUBLISH_PORT=4442 -e SE_EVENT_BUS_SUBSCRIBE_PORT=4443 \
selenium/node-chrome:4.24Point your driver at http://localhost:4444/wd/hub. Scale nodes horizontally as you add parallel tests.
7. CI wiring — GitHub Actions with Grid
Run Grid as a service container, execute your Maven Surefire suite, publish Allure or ExtentReports as artifacts. See GitHub Actions + Selenium CI.
Frequently asked questions
1.Is Selenium dead in 2026?
2.Selenium or Playwright for a new project?
3.Which Selenium binding is best?
4.How does Selenium handle Shadow DOM?
5.What is the biggest Selenium anti-pattern in 2026?
Practice these questions
Work through 300+ Selenium questions with Java code snippets, Selenium 4, Grid, framework patterns and CI/CD scenarios.
Was this article helpful?
More from Selenium WebDriver Basics
Locators, waits, WebDriver setup — the foundation.
- Automation TestingSelenium WebDriver 2026 — Zero to Production (Free 32-Min Guide)
- Automation TestingSelenium Python Automation Interview: 25 Questions (2026)
- Automation TestingHow to Write Stable Selenium Locators That Don't Break
Keep building your QA edge
Pillar guides- Playwright Pillarthis in-depth Playwright walkthrough300 Playwright Q&A, framework design, and migration guides.
- XPath & CSS Selector Generatorgenerate robust Playwright and Selenium locatorsInteractive locator generator for Playwright, Selenium and Cypress — with Page Object export.
- Automation QA Engineer RoleAutomation QA Engineer career guideAutomation QA Engineer job scope, tools, salary, and hiring pipeline.
- QA Skills HubQA skills hubStructured skill tracks — Selenium, Playwright, Cypress, API, JMeter, SQL, Java, Python for testers.
Practice these questions live
Rehearse with an AI QA interviewer that scores your answers in real time.
Continue reading

Playwright Locator Best Practices (2026) — The Only Guide You Need
11 min read
How to Migrate a Postman Collection to Playwright API Tests (2026 Guide)
12 min read
Why Every QA Engineer Must Master CI/CD Pipelines in 2026 (Or Risk Obsolescence)
12 min readRelated concepts, tools & standards around Automation Testing
A quick reference of the people, companies, frameworks and technologies most often mentioned alongside Automation Testing in real QA teams — useful when you're mapping a learning path, preparing for interviews, or scoping a new project.
Join the QA Community
Connect with fellow testers, share job leads, and get career advice.
Stop Reinventing the Wheel. Upgrade Your QA Arsenal.
Take your testing skills from beginner to Lead Engineer. Supercharge your daily workflow with our premium digital resources.
- Ready-to-use testing strategy templates
- Advanced API & UI automation guides
- ⏱️ Save 10+ hours a week on test planning
Discussion
Ask a question, share your experience, or correct us. Be kind — real people are reading.