testcontainers/testcontainers-java · error · UnsupportedOperationException
For browser 'MicrosoftEdge' selenium version must be 4 or…
Error message
For browser 'MicrosoftEdge' selenium version must be 4 or higher;docker images are available from there upwards;provided version: '${seleniumVersion}' What it means
BrowserWebDriverContainer.getStandardImageForCapabilities maps a browser type to a docker image. Edge standalone (non-debug) selenium docker images only exist from Selenium 4 onwards; if the configured selenium version is < 4 (so a debug image would be needed but Edge has no debug variant), it throws UnsupportedOperationException with this message.
Solutions
- Upgrade the selenium version/tag to 4.x or higher, e.g. selenium/standalone-edge:4.9.0.
- Switch to the newer org.testcontainers.selenium.BrowserWebDriverContainer or SeleniumContainer APIs supporting modern Edge images.
- If Selenium 3 is mandatory, switch the browser to Chrome or Firefox which have debug images.
- Make sure the seleniumVersion field/property is not defaulted from an old constant.
Example fix
// before
container.withCapabilities(new EdgeOptions())
.withRecordingFileFactory(...) // seleniumVersion = 3.141.59
// after
System.setProperty("selenium.version", "4.9.0"); // or use selenium/standalone-edge:4.x tag
container.withCapabilities(new EdgeOptions())... Defensive patterns
Strategy: validation
Validate before calling
static void requireSelenium4ForEdge(String seleniumVersion) {
int major = Integer.parseInt(seleniumVersion.split("\\.")[0]);
if ("MicrosoftEdge".equals(browser) && major < 4)
throw new IllegalArgumentException("Edge requires selenium >= 4, got " + seleniumVersion);
} Try / catch
try {
String image = BrowserWebDriverContainer.standardImageForCapabilities("MicrosoftEdge", version);
} catch (UnsupportedOperationException e) {
if (e.getMessage().contains("MicrosoftEdge")) {
version = "4.9.0"; // retry with Selenium 4 tag
image = BrowserWebDriverContainer.standardImageForCapabilities("MicrosoftEdge", version);
} else throw e;
} Prevention
- Pin selenium image tags to 4.x for Edge tests
- Don't source seleniumVersion from legacy Selenium 3 constants
- Prefer the maintained selenium module containers
When it happens
Trigger: Using BrowserWebDriverContainer (deprecated module) with an Edge/Firefox-capabilities lookup while the selenium image tag is 3.x, e.g. seleniumVersion="3.141.59" and browser=MicrosoftEdge via standardImageForCapabilities or getDockerImageForCapabilities.
Common situations: Legacy test suites pinned to Selenium 3 images, migrating old code that used Edge on selenium/standalone-debug 3.x, env-var or property supplying an old selenium version.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Browser name must be 'chrome', 'firefox' or…
- Setting a in not supported in the versions below 22.1.0
- Redpanda version must be >= v22.2.1
- Exception while trying to create temp directory
- Exception while trying to create temp directory
AI-assisted analysis of testcontainers/testcontainers-java@8e549514e3 (2026-09-12).
Data as JSON: /api/errors/b48ff2feb808841f.
Report an issue: GitHub.
Appendix: source
Thrown at modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java:262
@Deprecated
public static String getDockerImageForCapabilities(Capabilities capabilities, String seleniumVersion) {
return getStandardImageForCapabilities(capabilities, seleniumVersion).asCanonicalNameString();
}
private static DockerImageName getStandardImageForCapabilities(Capabilities capabilities, String seleniumVersion) {
String browserName = capabilities == null ? BrowserType.CHROME : capabilities.getBrowserName();
boolean supportsVncWithoutDebugImage = new ComparableVersion(seleniumVersion).isGreaterThanOrEqualTo("4");
switch (browserName) {
case BrowserType.CHROME:
return (supportsVncWithoutDebugImage ? CHROME_IMAGE : CHROME_DEBUG_IMAGE).withTag(seleniumVersion);
case BrowserType.FIREFOX:
return (supportsVncWithoutDebugImage ? FIREFOX_IMAGE : FIREFOX_DEBUG_IMAGE).withTag(seleniumVersion);
case BrowserType.EDGE:
if (supportsVncWithoutDebugImage) {
return EDGE_IMAGE.withTag(seleniumVersion);
}
throw new UnsupportedOperationException(
"For browser 'MicrosoftEdge' selenium version must be 4 or higher;" +
"docker images are available from there upwards;" +
"provided version: '" +
seleniumVersion +
"'"
);
default:
throw new UnsupportedOperationException(
"Browser name must be 'chrome', 'firefox' or 'MicrosoftEdge';" +
"provided '" +
browserName +
"' is not supported"
);
}
}
public URL getSeleniumAddress() {
try {View on GitHub (pinned to 8e549514e3)