{"record":{"id":"4bdbdf5decc85c9f","repo":"testcontainers/testcontainers-java","slug":"failed-to-determine-selenium-version-from-classpath-will-use","errorCode":null,"errorMessage":"Failed to determine Selenium version from classpath - will use default version of {}","messagePattern":"Failed to determine Selenium version from classpath - will use default version of (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/selenium/src/main/java/org/testcontainers/containers/SeleniumUtils.java","lineNumber":53,"sourceCode":"            while (manifests.hasMoreElements()) {\n                URL manifestURL = manifests.nextElement();\n                try (InputStream is = manifestURL.openStream()) {\n                    Manifest manifest = new Manifest();\n                    manifest.read(is);\n\n                    String seleniumVersion = getSeleniumVersionFromManifest(manifest);\n                    if (seleniumVersion != null) {\n                        seleniumVersions.add(seleniumVersion);\n                        LOGGER.info(\"Selenium API version {} detected on classpath\", seleniumVersion);\n                    }\n                }\n            }\n        } catch (Exception e) {\n            LOGGER.debug(\"Failed to determine Selenium-Version from selenium-api JAR Manifest\", e);\n        }\n\n        if (seleniumVersions.size() == 0) {\n            LOGGER.warn(\n                \"Failed to determine Selenium version from classpath - will use default version of {}\",\n                DEFAULT_SELENIUM_VERSION\n            );\n            return DEFAULT_SELENIUM_VERSION;\n        }\n\n        String foundVersion = seleniumVersions.iterator().next();\n        if (seleniumVersions.size() > 1) {\n            LOGGER.warn(\n                \"Multiple versions of Selenium API found on classpath - will select {}, but this may not be reliable\",\n                foundVersion\n            );\n        }\n\n        return foundVersion;\n    }\n\n    /**","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/selenium/src/main/java/org/testcontainers/containers/SeleniumUtils.java#L35-L71","documentation":"SeleniumUtils.determineClasspathSeleniumVersion logs this warning when it cannot detect the Selenium API version from the classpath JAR manifests and falls back to DEFAULT_SELENIUM_VERSION. The detected version picks the matching Selenium Docker image; a wrong default may mismatch the Selenium version your tests compile against. This is a warning only; a default version is returned.","triggerScenarios":"Running tests where the selenium-api jar (or its Manifest with Selenium-Version attribute) is absent or unreadable, e.g. shaded/fat jars, relocated selenium-api, or a classpath without selenium-api.","commonSituations":"Shadowed test jars stripping manifests; exotic build setups (Gradle shadow plugin, ProGuard); dockerized test runners with trimmed classpaths; non-Maven dependency layouts.","solutions":["Ensure the standard selenium-api dependency is a direct, non-shaded test dependency so its JAR manifest is readable.","Pin the image explicitly via SeleniumUtils / withRecordingFileFactory alternatives or set the desired Docker image instead of relying on detection.","Un-shadow or keep manifests in the shaded jar (keep 'META-INF/MANIFEST.MF' and selenium manifest attributes)."],"exampleFix":"// before\ndockerImageName.parse(\"selenium/standalone-chrome:\" + SeleniumUtils.determineClasspathSeleniumVersion()); // falls back silently\n// after\ndockerImageName.parse(\"selenium/standalone-chrome:4.10.0\"); // pinned explicitly","handlingStrategy":"fallback","validationCode":"// ensure selenium-api is a direct dependency\nClass.forName(\"org.openqa.selenium.remote.RemoteWebDriver\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare selenium-api as a direct test dependency","Avoid shading jars in ways that strip MANIFEST.MF","Pin the Selenium Docker image version explicitly instead of relying on detection"],"tags":["selenium","classpath","version-detection"],"backgroundTag":"missing-dependency","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"}