{"record":{"id":"d58a933c024f3e05","repo":"testcontainers/testcontainers-java","slug":"browser-name-must-be-chrome-firefox-or-microsoftedge","errorCode":null,"errorMessage":"Browser name must be 'chrome', 'firefox' or 'MicrosoftEdge';provided '${browserName}' is not supported","messagePattern":"Browser name must be 'chrome', 'firefox' or 'MicrosoftEdge';provided '(.+?)' is not supported","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java","lineNumber":270,"sourceCode":"\n        switch (browserName) {\n            case BrowserType.CHROME:\n                return (supportsVncWithoutDebugImage ? CHROME_IMAGE : CHROME_DEBUG_IMAGE).withTag(seleniumVersion);\n            case BrowserType.FIREFOX:\n                return (supportsVncWithoutDebugImage ? FIREFOX_IMAGE : FIREFOX_DEBUG_IMAGE).withTag(seleniumVersion);\n            case BrowserType.EDGE:\n                if (supportsVncWithoutDebugImage) {\n                    return EDGE_IMAGE.withTag(seleniumVersion);\n                }\n                throw new UnsupportedOperationException(\n                    \"For browser 'MicrosoftEdge' selenium version must be 4 or higher;\" +\n                    \"docker images are available from there upwards;\" +\n                    \"provided version: '\" +\n                    seleniumVersion +\n                    \"'\"\n                );\n            default:\n                throw new UnsupportedOperationException(\n                    \"Browser name must be 'chrome', 'firefox' or 'MicrosoftEdge';\" +\n                    \"provided '\" +\n                    browserName +\n                    \"' is not supported\"\n                );\n        }\n    }\n\n    public URL getSeleniumAddress() {\n        try {\n            return new URL(\"http\", getHost(), getMappedPort(SELENIUM_PORT), \"/wd/hub\");\n        } catch (MalformedURLException e) {\n            e.printStackTrace(); // TODO\n            return null;\n        }\n    }\n\n    public String getVncAddress() {","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/selenium/src/main/java/org/testcontainers/containers/BrowserWebDriverContainer.java#L252-L288","documentation":"BrowserWebDriverContainer.getStandardImageForCapabilities only supports chrome, firefox and MicrosoftEdge browser types when selecting the standard selenium docker image. Any other browser name falls to the default switch branch and throws UnsupportedOperationException listing the supported browsers.","triggerScenarios":"Calling standardImageForCapabilities(\"safari\"/\"htmlunit\"/arbitrary name, version) or getDockerImageForCapabilities with Capabilities whose getBrowserName() is not chrome/firefox/MicrosoftEdge.","commonSituations":"Passing Safari, InternetExplorer, Opera or HtmlUnit capabilities; typos like 'edge' or 'Chrome' (case-sensitive match against BrowserType constants).","solutions":["Use ChromeOptions, FirefoxOptions or EdgeOptions so the browser name is exactly 'chrome', 'firefox' or 'MicrosoftEdge'.","Fix typos/casing: use 'MicrosoftEdge' not 'edge'/'Edge', 'chrome' not 'Chrome'.","Remove unsupported browser types (Safari, IE, HtmlUnit) from testcontainers-based tests or run them outside testcontainers.","Extend/override image selection yourself if you need another browser instead of relying on the standard mapping."],"exampleFix":"// before\ncontainer.withCapabilities(new SafariOptions()); // unsupported\n// after\ncontainer.withCapabilities(new ChromeOptions());","handlingStrategy":"validation","validationCode":"static boolean isSupportedBrowser(String name) {\n  return \"chrome\".equals(name) || \"firefox\".equals(name) || \"MicrosoftEdge\".equals(name);\n}\n// assert isSupportedBrowser(capabilities.getBrowserName());","typeGuard":"static boolean isSupportedBrowser(Capabilities caps) {\n  String n = caps != null ? caps.getBrowserName() : null;\n  return \"chrome\".equals(n) || \"firefox\".equals(n) || \"MicrosoftEdge\".equals(n);\n}","tryCatchPattern":"try {\n  String image = BrowserWebDriverContainer.standardImageForCapabilities(browserName, version);\n} catch (UnsupportedOperationException e) {\n  if (e.getMessage().contains(\"Browser name must be\")) {\n    throw new IllegalArgumentException(\"Use chrome/firefox/MicrosoftEdge, got: \" + browserName); }\n  throw e;\n}","preventionTips":["Always pass capabilities from ChromeOptions/FirefoxOptions/EdgeOptions","Respect exact casing: 'MicrosoftEdge', 'chrome', 'firefox'","Don't hardcode browser name strings; use BrowserType constants"],"tags":["selenium","browser-capabilities","unsupported-browser","illegal-argument"],"backgroundTag":"invalid-enum-value","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"}