SeleniumHQ / selenium

A browser automation framework and ecosystem.
https://selenium.dev
Apache License 2.0
30.18k stars 8.1k forks source link

[🐛 Bug]: v4.16.1 Not able to open a browser with NoSuchDriverException #13263

Closed letskodeit closed 9 months ago

letskodeit commented 9 months ago

What happened?

I have written a very simple code on my Windows system to open a browser and it is not working with any browser, ex: Chrome or Edge when I am using version 4.16.1

The same code is working without any issues with version 4.11.0 and 4.15.0

How can we reproduce the issue?

Here is the simple code:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;

public class MSEdgeDriverDemo {
    public static void main(String[] args) {

        WebDriver driver = new EdgeDriver();
        driver.manage().window().maximize();
        driver.get("https://www.letskodeit.com");
        driver.quit();
    }
}

Relevant log output

Here are the errors:

Exception in thread "main" org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}, error Command failed with code: -1073741701, executed: [--browser, MicrosoftEdge, --output, json]

Build info: version: '4.16.0', revision: '15400459dd*'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:25)
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:13)
    at org.openqa.selenium.edge.EdgeDriver.generateExecutor(EdgeDriver.java:72)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:61)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:57)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:49)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:45)
    at basicweb.MSEdgeDriverDemo.main(MSEdgeDriverDemo.java:9)
Caused by: org.openqa.selenium.WebDriverException: Command failed with code: -1073741701, executed: [--browser, MicrosoftEdge, --output, json]

Build info: version: '4.16.0', revision: '15400459dd*'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:157)
    at org.openqa.selenium.manager.SeleniumManager.getDriverPath(SeleniumManager.java:299)
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:22)
    ... 7 more

Operating System

Windows

Selenium version

Java 4.16.1

What are the browser(s) and version(s) where you see this issue?

Edge Version 119.0.2151.97 and Chrome Version 119.0.6045.200

What are the browser driver(s) and version(s) where you see this issue?

Using Selenium latest version to download drivers automatically

Are you using Selenium Grid?

N/A

github-actions[bot] commented 9 months ago

@letskodeit, thank you for creating this issue. We will troubleshoot it as soon as we can.


Info for maintainers

Triage this issue by using labels.

If information is missing, add a helpful comment and then I-issue-template label.

If the issue is a question, add the I-question label.

If the issue is valid but there is no time to troubleshoot it, consider adding the help wanted label.

If the issue requires changes or fixes from an external project (e.g., ChromeDriver, GeckoDriver, MSEdgeDriver, W3C), add the applicable G-* label, and it will provide the correct link and auto-close the issue.

After troubleshooting the issue, please add the R-awaiting answer label.

Thank you!

github-actions[bot] commented 9 months ago

We need more information about this issue in order to troubleshoot.

Please turn on logging and re-run your code. Information on how to adjust logs for your language can be found in our Troubleshooting documentation.

titusfortner commented 9 months ago

duplicate of #13261

letskodeit commented 9 months ago

@titusfortner Can you please let me know how to enable logging? I referred to the documentation and tried to enable. I followed these steps:

  1. Downloaded the dependency using this:

    <dependency>
    <groupId>com.titusfortner</groupId>
    <artifactId>selenium-logger</artifactId>
    <version>2.3.0</version>
    </dependency>
  2. Added this line in the code before initializing the driver SeleniumLogger.enable();

Example:

import org.openqa.selenium.WebDriver;
import org.openqa.selenium.edge.EdgeDriver;

import com.titusfortner.logging.SeleniumLogger;

public class MSEdgeDriverDemo {
    public static void main(String[] args) {

        SeleniumLogger.enable();

        WebDriver driver = new EdgeDriver();
        driver.manage().window().maximize();
        driver.get("https://www.letskodeit.com");
        driver.quit();
    }
}

I still see the same error in Console:

2023-12-07 11:12:26 FINE Selenium [SeleniumManager getBinary] Selenium Manager binary found at: C:\Users\aniltomar\.cache\selenium\manager\0.4.16\selenium-manager.exe 
2023-12-07 11:12:26 FINE Selenium [SeleniumManager runCommand] Executing Process: [--browser, MicrosoftEdge, --output, json, --debug] 
2023-12-07 11:12:27 FINE Selenium [ExternalProcess] completed to copy the output of process 4848 
Exception in thread "main" org.openqa.selenium.remote.NoSuchDriverException: Unable to obtain: Capabilities {browserName: MicrosoftEdge, ms:edgeOptions: {args: [], extensions: []}}, error Command failed with code: -1073741701, executed: [--browser, MicrosoftEdge, --output, json, --debug]

Build info: version: '4.16.1', revision: '9b4c83354e'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:25)
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:13)
    at org.openqa.selenium.edge.EdgeDriver.generateExecutor(EdgeDriver.java:72)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:61)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:57)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:49)
    at org.openqa.selenium.edge.EdgeDriver.<init>(EdgeDriver.java:45)
    at basicweb.MSEdgeDriverDemo.main(MSEdgeDriverDemo.java:12)
Caused by: org.openqa.selenium.WebDriverException: Command failed with code: -1073741701, executed: [--browser, MicrosoftEdge, --output, json, --debug]

Build info: version: '4.16.1', revision: '9b4c83354e'
System info: os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.6'
Driver info: driver.version: EdgeDriver
    at org.openqa.selenium.manager.SeleniumManager.runCommand(SeleniumManager.java:157)
    at org.openqa.selenium.manager.SeleniumManager.getDriverPath(SeleniumManager.java:299)
    at org.openqa.selenium.remote.service.DriverFinder.getPath(DriverFinder.java:22)
    ... 7 more
titusfortner commented 9 months ago

Oh, ok, so Selenium Manager isn't even starting. This failure is before it starts logging anything.

dj-luis198 commented 9 months ago

install VC++ redistributable x86 solves the problem.

letskodeit commented 9 months ago

@titusfortner @dj-luis198

Does it mean 4.15 version doesn't need Visual C++ Redistributable for Visual Studio 2015-2022?

anjalivaswani8614 commented 8 months ago

I'm facing the similar issue however for me SeleniumManager Exe is not even getting downloaded. Im working behind the proxy and browser is not getting launched.

Here is the issue: I'm facing the issue where getting the error: org.openqa.selenium.WebDriverException: Unable to obtain Selenium Manager Binary at: C:\Users.cache\selenium\manager\0.4.16\selenium-manager.exe Build info: version: '4.16.1', revision: '9b4c83354e' System info: os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '17.0.9' Driver info: driver.version: unknown at org.openqa.selenium.manager.SeleniumManager.getBinary(SeleniumManager.java:210) at org.openqa.selenium.manager.SeleniumManager.getDriverPath(SeleniumManager.java:253)

Browser is not launching . ChromeOptions chromeOptions = new ChromeOptions(); chromeOptions.setCapability("goog:chromeOptions", true); chromeOptions.addArguments("--no-sandbox"); chromeOptions.addArguments("--remote-allow-origins=*"); chromeOptions.addArguments("--ignore-certificate-errors"); chromeOptions.addArguments("--proxy-server=http://",PROXY_URL_STRING); chromeOptions.addArguments("--proxy=http://",PROXY_URL); chromeOptions.addArguments("--start-maximized");

ChromeOptions ChromeOpt = new ChromeOptions();
// Pass the ChromeOpt option it takes as a type of Capability.
String chromeDriverPath = String.valueOf(SeleniumManager.getInstance().getDriverPath(chromeOptions,false));
System.out.println("chromeDriverPath--" + chromeDriverPath);

return this.driver= new ChromeDriver(chromeOptions);

Many times selenium chrome driver exe is not getting downloaded without using WebDriver Manager.

diemol commented 8 months ago

As I replied in the other issue you opened, please use Nightly as a workaround https://www.selenium.dev/downloads/#nightly

github-actions[bot] commented 7 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.