unknown error: cannot find Chrome binary
kedziorm opened this issue · 1 comments
kedziorm commented
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 commented
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\