SoftwareTestPilot
Automation TestingPublished: 18 min read

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.

Avinash Kamble
Founder & QA Engineer at SoftwareTestPilot
Reviewed by Priyanka G.
Share:XLinkedInWhatsApp
Selenium WebDriver complete guide 2026 — Selenium 4 relative locators, BiDi, Grid 4.
Selenium WebDriver complete guide 2026 — Selenium 4 relative locators, BiDi, Grid 4.

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 locatorsabove, 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.xml

Deeper: 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.24

Point 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?
No. It powers the majority of enterprise regression suites. Selenium 4 modernized the API and Grid — the platform is actively maintained.
2.Selenium or Playwright for a new project?
Playwright unless you have Selenium Grid infrastructure, Java-heavy skills, or vendor lock-in on tools that only integrate with WebDriver.
3.Which Selenium binding is best?
Java has the most jobs; Python has the fastest onboarding; C# for .NET shops. All three are first-class.
4.How does Selenium handle Shadow DOM?
Selenium 4 added getShadowRoot() on WebElement. Works for open shadow roots; closed roots are inaccessible by design.
5.What is the biggest Selenium anti-pattern in 2026?
Sleeping instead of waiting, and using absolute XPath. Both cause the majority of flaky failures.
Keep going

Practice these questions

Work through 300+ Selenium questions with Java code snippets, Selenium 4, Grid, framework patterns and CI/CD scenarios.

Found this useful?
Share:XLinkedInWhatsApp

Was this article helpful?

Cluster · Selenium

More from Selenium WebDriver Basics

Locators, waits, WebDriver setup — the foundation.

Pillar guide · 5 articles
More in this cluster
From the Selenium pillar

Keep building your QA edge

Practice these questions live

Rehearse with an AI QA interviewer that scores your answers in real time.

Start a Free AI Mock Interview →

Continue reading

Topic mapConcepts · Tools · People · Standards

Related 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.

Core testing concepts
Explicit vs Implicit WaitsPageFactoryTest PyramidShift-Left TestingBehavior-Driven DevelopmentTest-Driven DevelopmentPage Object ModelContract TestingExploratory TestingRisk-Based Testing
Testing tools
Programming languages
JavaPythonJavaScriptTypeScriptC#SQL
Certifications worth knowing
ISTQB Foundation LevelISTQB Advanced — Test AnalystISTQB Agile TesterCertified Selenium ProfessionalAWS Certified DevOps EngineerCertified ScrumMaster (CSM)
Companies hiring for this skill
GoogleMicrosoftAmazonMetaNetflixAtlassianThoughtWorksInfosysTCSWipro

Discussion

Ask a question, share your experience, or correct us. Be kind — real people are reading.

Join the QA Community

Connect with fellow testers, share job leads, and get career advice.

Premium QA Resources

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
4.9/5 rating
Explore All Products

⭐⭐⭐⭐⭐ Trusted by 1,000+ Software Test Pilots • Instant Access