Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversOctober DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix Now×
Skip to content
World desk5 min

How to Fix “Unable to Import org.openqa.selenium.WebDriver” with Selenium and Java 11

The WebDriver import is correct. Add Selenium’s Java dependency to the right module and source set, refresh the IDE project, and verify with a clean build. Java 11 meets Selenium 4’s documented minimum.

Free tools Windows power users keep installed

One-click scans. No signup required.

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

The import is valid: import org.openqa.selenium.WebDriver;. If Java cannot resolve it, first make sure the Selenium Java library is declared as a dependency of the module and source set containing your file. Then refresh the Maven or Gradle project and run a clean build. Java 11 meets Selenium 4’s documented minimum Java version of 8, so Java 11 alone is not the likely explanation.

Without your build file and full error message, the exact cause cannot be identified. The checks below distinguish a missing or misplaced dependency from an IDE synchronization problem.

As an Amazon Associate I earn from qualifying purchases.

1. Check the import and the file that reports the error

Use Selenium’s fully qualified type name exactly:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import org.openqa.selenium.WebDriver;

For example, this minimal class should compile when the Selenium Java dependency is on the compile classpath:

import org.openqa.selenium.WebDriver;

public class DriverExample {
    private WebDriver driver;
}

The import is not a command to install Selenium. It tells the compiler which class the source file uses; the class must also be available through the project’s dependencies. If the import is spelled correctly but the editor reports “cannot resolve symbol” or the compiler reports “package org.openqa.selenium does not exist,” check the dependency and its scope next.

2. Add Selenium to the affected project

Selenium’s Java library is published as org.seleniumhq.selenium:selenium-java. Declare it in the build file for the module that contains the source file. Use a current stable version from Selenium’s Downloads page rather than copying an old version from an unrelated example. Selenium’s Downloads page listed 4.49.0 as stable, released September 9, 2026; versions can change, so verify the current listing when choosing a version.

Maven

Add this dependency inside the project’s <dependencies> element in the relevant module’s pom.xml:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
<dependency>
  <groupId>org.seleniumhq.selenium</groupId>
  <artifactId>selenium-java</artifactId>
  <version>4.49.0</version>
</dependency>

The version above is the stable version listed on September 9, 2026, not a timeless recommendation. Check Selenium’s current Downloads page before using it in a new project. If the file is in a Maven submodule, put the dependency in that submodule’s build configuration or ensure the parent configuration actually supplies it to that module.

Gradle

For source code used only by tests, add the dependency to the test source set in the relevant module’s build.gradle:

dependencies {
    testImplementation 'org.seleniumhq.selenium:selenium-java:4.49.0'
}

For production source code that directly uses WebDriver, use implementation instead:

dependencies {
    implementation 'org.seleniumhq.selenium:selenium-java:4.49.0'
}

As with the Maven example, confirm the version against Selenium’s current Downloads page. A test-only dependency will not make Selenium types available to production source files; choose the configuration that matches where the file lives.

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

3. Refresh the build model, then compile outside the editor

  1. Save the build file. Verify the dependency is in the module containing the failing source file, not just another module.
  2. Reload the project in your IDE. Use the IDE’s Maven reload/reimport or Gradle sync action. The exact menu label varies by IDE and version.
  3. Run a clean build from the project directory. For Maven, run mvn clean compile. For Gradle, run ./gradlew clean build (on Windows, use gradlew.bat clean build).
  4. Compare the result. If the command-line build succeeds but the editor still marks the import as unresolved, investigate IDE synchronization or project configuration. If the command-line build fails too, use its first dependency-resolution or compilation error to guide the next check.

4. Diagnose the failure by its symptom

What you see What to check Next action
The IDE flags the import, but the command-line build succeeds The IDE may have a stale or differently configured project model. Reload or reimport the Maven/Gradle project and confirm the IDE opened the project at the correct root.
The build says package org.openqa.selenium does not exist The dependency may be missing from this module, in the wrong source-set scope, or not resolved. Check the dependency coordinates and module placement; then inspect the build output for artifact-resolution errors.
Tests can see the import but production code cannot The dependency may be declared only as testImplementation or in a test-only Maven scope. Use a production compile scope, such as Gradle implementation, if production sources need Selenium.
One module resolves it and another does not Dependencies are generally associated with a particular project/module and may not be available to a sibling module. Declare the dependency in the module that compiles the file, or configure a deliberate shared dependency arrangement.
The build reports that Selenium artifacts cannot be downloaded or resolved This is a dependency-resolution problem, distinct from an incorrect import. Read the repository/network/coordinate error in the build output and correct that resolution issue before troubleshooting the Java import.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

5. Check Java compatibility only after dependency resolution

Selenium’s upgrade guidance states that Selenium 4’s minimum required Java version is 8. Java 11 meets that documented minimum. This does not establish compatibility for every older Selenium release, build plugin, or project configuration; check the actual dependency and build output if the project still fails after Selenium resolves.

For Maven, inspect the JDK selected by the IDE and the JDK used by the command-line Maven process. For Gradle, check the project’s configured JDK and the JVM used to run Gradle. A mismatch can cause other build problems, but changing Java versions will not add a missing Selenium dependency to the compile classpath.

Or skip the browser setup

If your goal is to capture a website screenshot rather than build a Selenium-based browser workflow, ScreenshotNeo offers a screenshot API and MCP server. That is an alternative capture method, not a fix for a missing Selenium import. Its one-call request is:

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

See the ScreenshotNeo API documentation for request options. Cookie banners, popups, and chat widgets are removed before the shot; bot checks, blank pages, and failed loads are not billed. An MCP server lets AI agents take screenshots. The free plan includes 1,000 screenshots a month with no card, and paid plans start at $5 for 3,000. Sign up for the free plan.

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

Frequently Asked Questions

Does importing WebDriver require importing a browser driver class too?

No. The unresolved import in this case is the Selenium API type. Browser and driver setup is a separate step after the project can compile against Selenium.

Can I fix this by downloading a standalone WebDriver executable?

A browser driver executable is not the Selenium Java library dependency. Resolve the Java dependency first; then address browser-driver setup if a later runtime error requires it.

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.

Leave a Reply

Your email address will not be published. Required fields are marked *

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

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.