Closed mdmintz closed 1 year ago
Released in 4.12.3
- https://github.com/seleniumbase/SeleniumBase/releases/tag/v4.12.3
hello @mdmintz! first, thank you for the hard work on seleniumbase, it is much appreciated.
I've searched through closed issues on setting binary location and WSL, but haven't found anything too similar. I recognize this could fully be user error, but here goes.
I'm using: -WSL: Ubuntu-22.04 -chromedriver 120.0.6099.109 (installed via 'sbase get chromedriver 120', it was defaulting to installing version 114) -sbase4.22.0
Running the following:
CHROME_PATH = "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe" driver = Driver( uc=True, binary_location=CHROME_PATH )
results in the following error:
Warning: The Chromium binary specified is NOT valid! Expecting "chrome.exe" to be found in ['google-chrome', 'google-chrome-stable', 'chrome', 'chromium', 'chromium-browser', 'google-chrome-beta', 'google-chrome-dev', 'google-chrome-unstable', 'brave-browser', 'brave-browser-stable', 'opera', 'opera-stable'] for the browser / OS! (Will use default settings...)
It appears that sbase rightfully recognizes that I'm running code in Linux, and thus does not consider the binary location in Windows valid since it does not match the constants, but shouldn't setting binary_location
overcome that expectation?
Both
'/mnt/c/Program Files/Google/Chrome Beta/Application/chrome.exe', '/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe'
are also set to PATH, and appear when running os.environ.get("PATH").split(os.pathsep)
.
From searching through other issues, this function doesn't return anything:
print(detect_b_ver.chrome_on_windows_path())
Any insight or troubleshooting is appreciated, thanks again!
Hello @mingatupturndotorg, you mentioned that you're running on Ubuntu-22.04
, yet you're trying to use a .exe
file.
.exe
files aren't supported on Ubuntu. You should use one from the list provided: ['google-chrome', 'google-chrome-stable', 'chrome', 'chromium', 'chromium-browser', 'google-chrome-beta', 'google-chrome-dev', 'google-chrome-unstable', 'brave-browser', 'brave-browser-stable', 'opera', 'opera-stable']
(Those files don't have a file extension.)
For a Linux system, those are the supported binaries to choose from. Using a different one would lead to errors, so that is prevented during binary selection.
Thanks @mdmintz, that's a fair response. To clarify my use case or expected behavior - when using undetected-chromedriver, I could run the following script in Ubuntu with WSL:
CHROME_PATH = '/mnt/c/Program Files/Google/Chrome Beta/Application/chrome.exe'
options = uc.ChromeOptions()
options.binary_location = CHROME_PATH
driver = uc.Chrome(options=options)
and a headful Chrome installed in Windows would appear. Is that behavior possible with sbase?
@mingatupturndotorg I had not considered WSL (Windows Subsystem for Linux) - (https://ubuntu.com/wsl).
I'll add chrome.exe
as a valid option for binary_location
on Linux. That may resolve your issue.
(Will be in the next release.)
Thanks! Would a temporary fix be to add chrome.exe
to valid_chrome_binaries_on_linux
in constants.py
?
@mingatupturndotorg Yes, try that.
Add an option to specify the Chromium browser binary used
(For the browser executable, NOT the driver)
Supports the two main Chromium browsers: Chrome and Edge.
Example:
Also as an option for other Syntax Formats: