Selenium Driver issue - Unable to run the script

236 Views Asked by At

I'm unable to run the selenium script after providing the driver path. The installed edge browser version - Microsoft Edge Version 115.0.1901.188 (Official build) (64-bit)

enter image description here Driver installed into my Windows 10 64 bit laptop- Product Version - 115.0.1901.188 enter image description here

Please let me know why I'm seeing getting below exception when running the script. PFA, below for more details enter image description here

Please help me to resolve this issue.

Thanks, Shreyansh Singh

When running my selenium code using Java in Eclipse. Downloaded the edge browser and it's present under mentioned path in script.

2

There are 2 best solutions below

0
Shawn On BEST ANSWER

Since you are using Selenium v4.10.0, you don't really need to set the driver executable path anymore. If you do not provide the driver path, selenium's new tool SeleniumManager will download/handle the drivers for you.

So remove the System.setProperty line from your code as below:

public static void main(String[] args) {
    // TODO Auto-generated method stub
    WebDriver driver = new EdgeDriver();
    driver.get("https://www.google.com");        
    System.out.println(driver.getTitle());
    driver.close();
}
1
Shreyansh Singh On

Recently due to the latest update of Chrome browser the below script is getting failed. FYI, I'm using selenium version 4 Error Message-

Failure reason- Aug 23, 2023 10:16:27 AM org.openqa.selenium.remote.service.DriverService$Builder getLogOutput INFO: Driver logs no longer sent to console by default; https://www.selenium.dev/documentation/webdriver/drivers/service/#setting-log-output SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Exception in thread "main" org.openqa.selenium.SessionNotCreatedException: Could not start a new session. Response code 500. Message: session not created: This version of ChromeDriver only supports Chrome version 114 Current browser version is 116.0.5845.111 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Host info: host: 'RAGHUVANSHISHRE', ip: '192.168.217.1' Build info: version: '4.10.0', revision: 'c14d967899' System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '11.0.16' Driver info: org.openqa.selenium.chrome.ChromeDriver Command: [null, newSession {capabilities=[Capabilities {browserName: chrome, goog:chromeOptions: {args: [--remote-allow-origins=*], extensions: []}}]}] at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:140) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:96) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:68) at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:163) at org.openqa.selenium.remote.service.DriverCommandExecutor.invokeExecute(DriverCommandExecutor.java:196) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:171) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:531) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:227) at org.openqa.selenium.remote.RemoteWebDriver.(RemoteWebDriver.java:154) at org.openqa.selenium.chromium.ChromiumDriver.(ChromiumDriver.java:107) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:87) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:82) at org.openqa.selenium.chrome.ChromeDriver.(ChromeDriver.java:50) at NaveenAutomationLabs.checkBoxSelection.main(checkBoxSelection.java:13)

enter image description here

Please let me know how can I resolve this issue. Thanks