testcontainers/testcontainers-java · warning
No capabilities provided - this will cause an exception in…
Error message
No capabilities provided - this will cause an exception in future versions. Falling back to ChromeOptions
What it means
The deprecated BrowserWebDriverContainer.getWebDriver logs this warning when no capabilities were provided before creating the WebDriver, and silently falls back to ChromeOptions. In future library versions a missing capabilities argument will throw instead of falling back. Tests get a Chrome driver even if they intended another browser.
Solutions
- Call withCapabilities(new ChromeOptions()) (or FirefoxOptions etc.) explicitly before getWebDriver().
- Migrate off the deprecated BrowserWebDriverContainer to the newer modules/selenium BrowserWebDriverContainer API with explicit capabilities.
- If Chrome is intended, keep the fallback but set capabilities explicitly to silence the deprecation path.
Example fix
// before RemoteWebDriver driver = container.getWebDriver(); // after container.withCapabilities(new ChromeOptions()); RemoteWebDriver driver = container.getWebDriver();
Defensive patterns
Strategy: validation
Validate before calling
if (capabilities == null) {
container.withCapabilities(new ChromeOptions()); // or your desired options
}
RemoteWebDriver driver = container.getWebDriver(); Prevention
- Always call withCapabilities(...) before getWebDriver()
- Migrate off deprecated BrowserWebDriverContainer.getWebDriver to the modern API
- State browser options explicitly even when Chrome is the intent
When it happens
Trigger: Calling getWebDriver() on a BrowserWebDriverContainer without having called withCapabilities(...) (the field 'capabilities' remains null).
Common situations: Upgrading testcontainers code that previously auto-defaulted to Chrome; copy-pasted container setup omitting withCapabilities; relying on the deprecated container without migrating to Selenium 4's remoteWebDriver API.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- TIMEOUT_ERROR
- Exception while trying to create temp directory
- For browser 'MicrosoftEdge' selenium version must be 4 or…
- Browser name must be 'chrome', 'firefox' or…
- Exception while trying to create temp directory
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/112b1666cdd30457.
Report an issue: GitHub.
Appendix: source
Thrown at modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java:324
vncRecordingContainer.start();
}
}
/**
* Obtain a RemoteWebDriver instance that is bound to an instance of the browser running inside a new container.
* <p>
* All containers and drivers will be automatically shut down after the test method finishes (if used as a @Rule) or the test
* class (if used as a @ClassRule)
*
* @return a new Remote Web Driver instance
* @deprecated use {@link #getSeleniumAddress()} instead
*/
@Deprecated
public synchronized RemoteWebDriver getWebDriver() {
if (driver == null) {
if (capabilities == null) {
logger()
.warn(
"No capabilities provided - this will cause an exception in future versions. Falling back to ChromeOptions"
);
capabilities = new ChromeOptions();
}
driver =
Unreliables.retryUntilSuccess(
30,
TimeUnit.SECONDS,
() -> {
return Timeouts.getWithTimeout(
10,
TimeUnit.SECONDS,
() -> {
return new RemoteWebDriver(getSeleniumAddress(), capabilities);
}
);
}View on GitHub (pinned to 8e549514e3)