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

Error in webdriver.util get_browser_version_from_os for 32 bit applications #315

Closed
vong0 opened this issue Feb 22, 2022 · 6 comments · Fixed by #316
Closed

Error in webdriver.util get_browser_version_from_os for 32 bit applications #315

vong0 opened this issue Feb 22, 2022 · 6 comments · Fixed by #316
Assignees

Comments

@vong0
Copy link

vong0 commented Feb 22, 2022

the latest version of the webdriver manager has a bug where these is no space between program files and (x86).

r'(Get-Item -Path "$env:PROGRAMFILES(x86)\Google\Chrome\Application\chrome.exe").VersionInfo.FileVersion'

this results in errors since: 'C:\Program Files(x86)' does not exist.

to fix this, all "$env:PROGRAMFILES(x86)" should be replaced with "$env:PROGRAMFILES (x86)"

@vong0
Copy link
Author

vong0 commented Feb 22, 2022

hmm. not only that. the entirely of this method seems completely broken:

from webdriver_manager.utils import get_browser_version_from_os
get_browser_version_from_os("google-chrome")

the broken code seems to be somewhere here:

windows_browser_apps_to_cmd

@aleksandr-kotlyar
Copy link
Collaborator

@vong0 thank you for report! Please attach code and stacktrace to reproduce that.

@vong0
Copy link
Author

vong0 commented Feb 22, 2022

The code to reproduce, run on any windows machine with google chrome installed:

from webdriver_manager.utils import get_browser_version_from_os
get_browser_version_from_os("google-chrome")

Error Log:

[WDM] - 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 }"
[WDM] - Current google-chrome version is UNKNOWN

Note that when running manually on my machine one of these individual commands work:

(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

I think the issues lies at:

  • should be a space before (x86) in the dictionary definitions but even with that fix it still won't run
  • also this function "windows_browser_apps_to_cmd"

@vong0
Copy link
Author

vong0 commented Feb 22, 2022

Ok I did some more investigation. This only seems to apply for google chrome and on windows (edge + firefox work fine).

I'm using the latest release 3.5.3 but I also noticed this issue on the latest main.
This issue did NOT seem to fix it: #307

aleksandr-kotlyar added a commit to aleksandr-kotlyar/webdriver_manager that referenced this issue Feb 22, 2022
@aleksandr-kotlyar
Copy link
Collaborator

@vong0 please try now the current master branch from repo. PR #316 should fix this.

@vong0
Copy link
Author

vong0 commented Feb 23, 2022

thanks. i think that fixed it.

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

Successfully merging a pull request may close this issue.

2 participants