How to Fix Selenium Edge Driver Unknown Version Error in Java?
Introduction If you're encountering issues with Selenium and the Microsoft Edge driver indicating that the driver version is unknown, you're not alone. This common problem can arise for various reasons, especially if recent updates have been made to either Selenium or Microsoft Edge. In this article, we'll explore the possible causes of the SessionNotCreatedException error and provide you with step-by-step solutions to resolve it. Understanding the Error The error message you're facing typically reads: org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: NettyHttpHandler request execution error Host info: System info: os.name: 'Windows Server 2022', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_361' Driver info: driver.version: unknown This indicates that Selenium attempted to establish a session with the Edge browser but encountered a problem with the driver. Several factors can contribute to this issue, including: Version Mismatch: The version of the Edge driver might not align with the installed version of Microsoft Edge. Driver Configuration: Incorrect driver path configuration in your project can also lead to this error. Java Version: Ensure that your Java version is compatible with the driver version. Step 1: Verify Microsoft Edge and Driver Versions First, ensure your Microsoft Edge browser and WebDriver are compatible: Check Microsoft Edge Version: Open your Edge browser and navigate to edge://settings/help to find the current version. Download Matching Edge Driver: Visit the Microsoft Edge WebDriver page and download the version that matches your Edge installation. Step 2: Update Your Code Now, ensure your WebDriver setup method is correctly implemented and has the latest configurations. Here's a refined version of your setup method: private WebDriver setup(EdgeDriverService service) { System.setProperty("webdriver.edge.driver", prop.getSeleniumExe()); EdgeOptions options = new EdgeOptions(); if(!this.prop.isTrustedConnection()) { options.addArguments("--ignore-certificate-errors"); options.addArguments("--ignore-ssl-errors"); } options.addArguments("--headless"); options.addArguments("--disable-gpu"); options.addArguments("--disable-extensions"); options.setPageLoadTimeout(Duration.ofSeconds(60)); options.setScriptTimeout(Duration.ofSeconds(30)); options.setImplicitWaitTimeout(Duration.ofSeconds(30)); try { service.start(); } catch (IOException e) { log.debug(e.getMessage()); } ClientConfig clientConfig = ClientConfig.defaultConfig().readTimeout(Duration.ofSeconds(30)); WebDriver driver = RemoteWebDriver.builder() .oneOf(options) .withDriverService(service) .config(clientConfig) .build(); return driver; } Step 3: Check PATH Environment Variable It's crucial that the Edge driver path is correctly set in the Windows system's PATH environment variable. Ensure: Locate the Edge Driver: Find the location of msedgedriver.exe on your system. Add to PATH: To add it to your PATH, follow these steps: Right-click on 'This PC' or 'My Computer' and select 'Properties'. Click on 'Advanced system settings'. Click the 'Environment Variables' button. Under the 'System variables' section, find and select the Path variable, then click 'Edit'. Add the new path where msedgedriver.exe is located, then click OK. Step 4: Check Java JDK Compatibility Ensure that your Java Development Kit (JDK) version is compatible with both the Selenium and Edge versions. Update your JDK if necessary. You can check your current version by running: echo %JAVA_HOME% java -version Additional Troubleshooting Tips Upgrade Selenium Library: Ensure you are using the latest version of the Selenium library in your Maven pom.xml: org.seleniumhq.selenium selenium-java 4.X.X Run Tests: Once all settings and configurations are updated, run your tests to check if the problem persists. Also, debug any output logs for further insights. Frequently Asked Questions (FAQ) Q: Why is my Edge driver showing unknown version? A: This usually occurs due to a version mismatch or incorrect path. Ensure the Edge driver version matches your browser version. Q: How can I check the compatibility of Java with Selenium? A: Visit the Selenium documentation to verify compatibility charts between various versions of Selenium and Java. Conclusion By following the steps outlined in this article, you should be able to troubleshoot and resolve the SessionNotCreatedException: driver.version: unknown error in your Selenium Edge setup. Make sure to keep your software updated and configurations checked to prevent similar issues in the future.

Introduction
If you're encountering issues with Selenium and the Microsoft Edge driver indicating that the driver version is unknown, you're not alone. This common problem can arise for various reasons, especially if recent updates have been made to either Selenium or Microsoft Edge. In this article, we'll explore the possible causes of the SessionNotCreatedException
error and provide you with step-by-step solutions to resolve it.
Understanding the Error
The error message you're facing typically reads:
org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: NettyHttpHandler request execution error Host info:
System info:
os.name: 'Windows Server 2022', os.arch: 'amd64', os.version: '10.0',
java.version: '1.8.0_361' Driver info: driver.version: unknown
This indicates that Selenium attempted to establish a session with the Edge browser but encountered a problem with the driver. Several factors can contribute to this issue, including:
- Version Mismatch: The version of the Edge driver might not align with the installed version of Microsoft Edge.
- Driver Configuration: Incorrect driver path configuration in your project can also lead to this error.
- Java Version: Ensure that your Java version is compatible with the driver version.
Step 1: Verify Microsoft Edge and Driver Versions
First, ensure your Microsoft Edge browser and WebDriver are compatible:
-
Check Microsoft Edge Version: Open your Edge browser and navigate to
edge://settings/help
to find the current version. - Download Matching Edge Driver: Visit the Microsoft Edge WebDriver page and download the version that matches your Edge installation.
Step 2: Update Your Code
Now, ensure your WebDriver setup method is correctly implemented and has the latest configurations. Here's a refined version of your setup
method:
private WebDriver setup(EdgeDriverService service) {
System.setProperty("webdriver.edge.driver", prop.getSeleniumExe());
EdgeOptions options = new EdgeOptions();
if(!this.prop.isTrustedConnection()) {
options.addArguments("--ignore-certificate-errors");
options.addArguments("--ignore-ssl-errors");
}
options.addArguments("--headless");
options.addArguments("--disable-gpu");
options.addArguments("--disable-extensions");
options.setPageLoadTimeout(Duration.ofSeconds(60));
options.setScriptTimeout(Duration.ofSeconds(30));
options.setImplicitWaitTimeout(Duration.ofSeconds(30));
try {
service.start();
} catch (IOException e) {
log.debug(e.getMessage());
}
ClientConfig clientConfig = ClientConfig.defaultConfig().readTimeout(Duration.ofSeconds(30));
WebDriver driver = RemoteWebDriver.builder()
.oneOf(options)
.withDriverService(service)
.config(clientConfig)
.build();
return driver;
}
Step 3: Check PATH Environment Variable
It's crucial that the Edge driver path is correctly set in the Windows system's PATH
environment variable. Ensure:
-
Locate the Edge Driver: Find the location of
msedgedriver.exe
on your system. -
Add to PATH: To add it to your
PATH
, follow these steps:- Right-click on 'This PC' or 'My Computer' and select 'Properties'.
- Click on 'Advanced system settings'.
- Click the 'Environment Variables' button.
- Under the 'System variables' section, find and select the
Path
variable, then click 'Edit'. - Add the new path where
msedgedriver.exe
is located, then click OK.
Step 4: Check Java JDK Compatibility
Ensure that your Java Development Kit (JDK) version is compatible with both the Selenium and Edge versions. Update your JDK if necessary. You can check your current version by running:
echo %JAVA_HOME%
java -version
Additional Troubleshooting Tips
- Upgrade Selenium Library: Ensure you are using the latest version of the Selenium library in your Maven
pom.xml
:
org.seleniumhq.selenium
selenium-java
4.X.X
- Run Tests: Once all settings and configurations are updated, run your tests to check if the problem persists. Also, debug any output logs for further insights.
Frequently Asked Questions (FAQ)
Q: Why is my Edge driver showing unknown version?
A: This usually occurs due to a version mismatch or incorrect path. Ensure the Edge driver version matches your browser version.
Q: How can I check the compatibility of Java with Selenium?
A: Visit the Selenium documentation to verify compatibility charts between various versions of Selenium and Java.
Conclusion
By following the steps outlined in this article, you should be able to troubleshoot and resolve the SessionNotCreatedException: driver.version: unknown
error in your Selenium Edge setup. Make sure to keep your software updated and configurations checked to prevent similar issues in the future.