{"record":{"id":"112b1666cdd30457","repo":"testcontainers/testcontainers-java","slug":"no-capabilities-provided-this-will-cause-an-exception-in","errorCode":null,"errorMessage":"No capabilities provided - this will cause an exception in future versions. Falling back to ChromeOptions","messagePattern":"No capabilities provided - this will cause an exception in future versions\\. Falling back to ChromeOptions","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java","lineNumber":324,"sourceCode":"            vncRecordingContainer.start();\n        }\n    }\n\n    /**\n     * Obtain a RemoteWebDriver instance that is bound to an instance of the browser running inside a new container.\n     * <p>\n     * All containers and drivers will be automatically shut down after the test method finishes (if used as a @Rule) or the test\n     * class (if used as a @ClassRule)\n     *\n     * @return a new Remote Web Driver instance\n     * @deprecated use {@link #getSeleniumAddress()} instead\n     */\n    @Deprecated\n    public synchronized RemoteWebDriver getWebDriver() {\n        if (driver == null) {\n            if (capabilities == null) {\n                logger()\n                    .warn(\n                        \"No capabilities provided - this will cause an exception in future versions. Falling back to ChromeOptions\"\n                    );\n                capabilities = new ChromeOptions();\n            }\n\n            driver =\n                Unreliables.retryUntilSuccess(\n                    30,\n                    TimeUnit.SECONDS,\n                    () -> {\n                        return Timeouts.getWithTimeout(\n                            10,\n                            TimeUnit.SECONDS,\n                            () -> {\n                                return new RemoteWebDriver(getSeleniumAddress(), capabilities);\n                            }\n                        );\n                    }","sourceCodeStart":306,"sourceCodeEnd":342,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java#L306-L342","documentation":"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.","triggerScenarios":"Calling getWebDriver() on a BrowserWebDriverContainer without having called withCapabilities(...) (the field 'capabilities' remains null).","commonSituations":"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.","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."],"exampleFix":"// before\nRemoteWebDriver driver = container.getWebDriver();\n// after\ncontainer.withCapabilities(new ChromeOptions());\nRemoteWebDriver driver = container.getWebDriver();","handlingStrategy":"validation","validationCode":"if (capabilities == null) {\n    container.withCapabilities(new ChromeOptions()); // or your desired options\n}\nRemoteWebDriver driver = container.getWebDriver();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always call withCapabilities(...) before getWebDriver()","Migrate off deprecated BrowserWebDriverContainer.getWebDriver to the modern API","State browser options explicitly even when Chrome is the intent"],"tags":["selenium","deprecated","default-fallback"],"backgroundTag":"deprecated-api-usage","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}