用命令无法获得Google-Chrome的版本:PowerShell; powerShell; erroractionPreference =' sillysyContinue'将WebDrivermanager与硒一起使用
在使用Selenium和Chrome Driver运行Python脚本时,我会在下面遇到错误。
我使用所讨论的脚本进行一些非常简单的自动化在本地运行(Win 10)。 由于WebDridver无法获得Chrome版本,因此它安装了最新版本,导致脚本在Chrome具有更新时经常失败,但尚未安装。
====== WebDriver manager ======
Could not get version for google-chrome with the command: powershell "$ErrorActionPreference='silentlycontinue' ; (Get-Item -Path "$env:PROGRAMFILES\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion ; if (-not $? -or $? -match $error) { (Get-Item -Path "$env:PROGRAMFILES(x86)\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion } if (-not $? -or $? -match $error) { (Get-Item -Path "$env:LOCALAPPDATA\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion } if (-not $? -or $? -match $error) { reg query "HKCU\SOFTWARE\Google\Chrome\BLBeacon" /v version } if (-not $? -or $? -match $error) { reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v version }"
Current google-chrome version is UNKNOWN
Get LATEST chromedriver version for UNKNOWN google-chrome
Trying to download new driver from https://chromedriver.storage.googleapis.com/101.0.4951.41/chromedriver_win32.zip
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
此错误消息...
...表示 webdriver-manager 无法检测到 google-chrome 浏览器的版本使用以下任何一个命令:
(get -item -path“ $ env:programFiles \ google \ chrome \ chrome \ application \ chrome.exe”)
(get -item-path“ $ env:programFiles(x86)\ google \ chrome \ chrome \ application \ chrome.exe”)
reg QUERY”
深度潜水
在该问题似乎是以下任务:
-execution -ececution -ececution -ececution -ececution -ececution -ececution -ececution -ececution -ececution -bypass -nologo -nonInteractive -noprofile -command
在拉的某个时候 试标
最后,解决方案是修复powershell的确定和str CONSATINATION ://github.com/sergeypirogov/webdriver_manager/blob/352bd0ba13e5097935472f978f978f33bbbb908c9c3c3d6d6d6d6d6d/webdriver_manager/utils.manager/utils.py#l147
更新
到当前 可以解决问题。
This error message...
...implies that webdriver-manager was unable to detect the version of the google-chrome browser using either of the following commands:
(Get-Item -Path "$env:PROGRAMFILES\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion
(Get-Item -Path "$env:PROGRAMFILES(x86)\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion
(Get-Item -Path "$env:LOCALAPPDATA\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion
reg query "HKCU\SOFTWARE\Google\Chrome\BLBeacon" /v version
reg query "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v version
Deep Dive
This issue was discussed in google-chrome version is UNKNOWN with webdriver_manager 3.5.3 (Win) where the issue appeared to be either of the following:
-ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -Command
At some point in the pull request base64 encode powershell commands appeared base64 encoding was necessary.
Finally the fix was to fix powershell determination and str concatenation in
webdriver_manager/utils.py
:Solution
Update to current webdriver-manager version v3.5.4 which would solve the issue.