Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unknown error: cannot find Chrome binary #237

Open
kedziorm opened this issue Feb 9, 2024 · 1 comment
Open

unknown error: cannot find Chrome binary #237

kedziorm opened this issue Feb 9, 2024 · 1 comment

Comments

@kedziorm
Copy link

kedziorm commented Feb 9, 2024

PSVersion                      5.1.22621.2506
Windows 11
Chrome 121.0.6167.161

I just installed selenium-powershell
When I try to start Chrome from Powershell:

$Driver = Start-SeChrome

I see mentioned message:

$Driver = Start-SeChrome
Starting ChromeDriver 83.0.4103.39 (ccbf011cb2d2b19b506d844400483861342c20cd-refs/branch-heads/4103@{#416}) on port 60831
Only local connections are allowed.
Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
ChromeDriver was started successfully.
Exception calling ".ctor" with "2" argument(s): "unknown error: cannot find Chrome binary"
At C:\Program Files\WindowsPowerShell\Modules\Selenium\3.0.1\Selenium.psm1:253 char:9
+         $Driver = [OpenQA.Selenium.Chrome.ChromeDriver]::new($service ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : WebDriverException

WARNING: Web driver was not created

What should I do?
Why ChromeDriver is quite old: 83.0.4103.39

@mattcargile
Copy link

mattcargile commented May 2, 2024

I also tried

$driver = Start-SeChrome -StartURL 'https://www.google.com/ncr' -BinaryPath 'C:\Program Files\Google\Chrome\Application\'

And it gives me an error about not being able to start the process. This occurs in Desktop and Core.

PSMessageDetails      : 
Exception             : System.Management.Automation.MethodInvocationException: Exception calling ".ctor" with "2" argument(s): "unknown error: Failed to create Chrome process." ---> 
                        OpenQA.Selenium.WebDriverException: unknown error: Failed to create Chrome process.
                           at OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
                           at OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
                           at OpenQA.Selenium.Remote.RemoteWebDriver.StartSession(ICapabilities desiredCapabilities)
                           at OpenQA.Selenium.Remote.RemoteWebDriver..ctor(ICommandExecutor commandExecutor, ICapabilities desiredCapabilities)
                           at OpenQA.Selenium.Chrome.ChromeDriver..ctor(ChromeDriverService service, ChromeOptions options, TimeSpan commandTimeout)
                           at CallSite.Target(Closure , CallSite , Type , Object , Object )
                           --- End of inner exception stack trace ---
                           at System.Management.Automation.ExceptionHandlingOps.ConvertToMethodInvocationException(Exception exception, Type typeToThrow, String methodName, Int32 numArgs, MemberInfo 
                        memberInfo)
                           at CallSite.Target(Closure , CallSite , Type , Object , Object )
                           at System.Management.Automation.Interpreter.DynamicInstruction`4.Run(InterpretedFrame frame)
                           at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject          : 
CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
FullyQualifiedErrorId : WebDriverException
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Start-SeChrome<Process>, C:\Program Files\WindowsPowerShell\Modules\selenium\3.0.1\Selenium.psm1: line 253
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}

EDIT:

So I used scoop and winget to get it to work.

scoop install chromedriver
winget install --id Google.Chrome
$driver = Start-Sechrome -StartURL 'https://www.google.com/' -WebDriverDirectory C:\Users\user\scoop\shims\

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants