Skip to content

Windows: Python doesn't always recognize a customized System PATH for locating the local chromedriver in "seleniumbase/drivers/" #1008

@ksdaftari

Description

@ksdaftari

I have been using seleniumbase for past couple months, and noticing getting following error (my machine has windows 10 machine and Chrome browser verison = 94.0.4606.81 installed)

              else:  # Running headless on Linux
                    try:
                        return webdriver.Chrome(options=chrome_options)
                    except Exception:
                        # Use the virtual display on Linux during headless errors
                        logging.debug(
                            "\nWarning: Chrome failed to launch in"
                            " headless mode. Attempting to use the"
                            " SeleniumBase virtual display on Linux..."
                        )
                        chrome_options.headless = False
                        return webdriver.Chrome(options=chrome_options)
            except Exception as e:
                if headless:
>                   raise Exception(e)
E                   Exception: Message: session not created: This version of ChromeDriver only supports Chrome version 92        
E                   Current browser version is 94.0.4606.81 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe

..\venv\lib\site-packages\seleniumbase\core\browser_launcher.py:1621: Exception
----------------------------------------------------- Captured stdout call ----------------------------------------------------- 

*** chromedriver version for download = 2.44 (NOT Latest)

  To upgrade to the latest version of chromedriver,
   run this: >>> sbase install chromedriver latest
  (Requires the latest version of Chrome installed)

Downloading chromedriver_win32.zip from:
https://chromedriver.storage.googleapis.com/2.44/chromedriver_win32.zip ...
Download Complete!

Extracting ['chromedriver.exe'] from chromedriver_win32.zip ...
Unzip Complete!

The file [chromedriver.exe] was saved to:
~\venv\Lib\site-packages\seleniumbase\drivers/chromedriver.exe

Making [chromedriver.exe 2.44] executable ...
[chromedriver.exe] is now ready for use!


*** chromedriver version for download = 93.0.4577.63 (NOT Latest)

  To upgrade to the latest version of chromedriver,
   run this: >>> sbase install chromedriver latest
  (Requires the latest version of Chrome installed)

Downloading chromedriver_win32.zip from:
https://chromedriver.storage.googleapis.com/93.0.4577.63/chromedriver_win32.zip ...
Download Complete!

Extracting ['chromedriver.exe'] from chromedriver_win32.zip ...
Unzip Complete!

The file [chromedriver.exe] was saved to:
~\venv\Lib\site-packages\seleniumbase\drivers/chromedriver.exe

Making [chromedriver.exe 93.0.4577.63] executable ...
[chromedriver.exe] is now ready for use!

I had re-run sbase chromedriver latest returns what would expect

sbase install chromedriver latest

*** chromedriver version for download = 94.0.4606.61 (Latest)

Downloading chromedriver_win32.zip from:
https://chromedriver.storage.googleapis.com/94.0.4606.61/chromedriver_win32.zip ...
Download Complete!

Extracting ['chromedriver.exe'] from chromedriver_win32.zip ...
Unzip Complete!

The file [chromedriver.exe] was saved to:
~\venv\Lib\site-packages\seleniumbase\drivers/chromedriver.exe

Making [chromedriver.exe 94.0.4606.61] executable ...
[chromedriver.exe] is now ready for use!

and running test again still get same error. I am noticing during test execution it looks like it was not recognizing the webdriver installed by sbase (ie one installed under ~\venv\Lib\site-packages\seleniumbase\drivers\chromedriver.exe) and was overwriting the webdriver as the error message seems to indicate

Looking into this assuming the overwrite was happening in this section of code: https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L1538 was failing and trying to auto upgrade. with this noticed when I change https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/core/browser_launcher.py#L1537 from driver = webdriver.Chrome(options=chrome_options) to driver = webdriver.Chrome(executable_path=LOCAL_CHROMEDRIVER,options=chrome_options) test and everything start to work again on my windows computer.

Also FYI, we have seleniumbase running on linux servers and re-running our tests (which goes through whole installation process) not seeing this issue pop up. so dont know if this is just windows issue (or more likely a me issue). in either case didnt know if had any insight or seen similar issues brought up by others before and how would fix

Metadata

Metadata

Assignees

Labels

bugUh oh... Something needs to be fixed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions