SameerDalal / QuantumGo_Engine

GNU Affero General Public License v3.0
0 stars 1 forks source link

Crash with modern versions of Chrome #2

Closed benjaminpjones closed 2 months ago

benjaminpjones commented 2 months ago

I have Chromium version 127.0.6533.99, but I get an error when trying to run the script: This version of ChromeDriver only supports Chrome version 114. I was able to resolve it by removing the ChromeDriverManager().install() from web_board.py.

$ python main.py -l 3
Traceback (most recent call last):
  File ".../QuantumGo_Engine/main.py", line 9, in <module>
    env = QuantumGame()
          ^^^^^^^^^^^^^
  File ".../QuantumGo_Engine/main.py", line 7, in __init__
    engine.run()
  File ".../QuantumGo_Engine/engine.py", line 30, in run
    board = Board()
            ^^^^^^^
  File ".../QuantumGo_Engine/web_board.py", line 43, in __init__
    self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()), options=options)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/chrome/webdriver.py", line 45, in __init__
    super().__init__(
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/chromium/webdriver.py", line 66, in __init__
    super().__init__(command_executor=executor, options=options)
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 212, in __init__
    self.start_session(capabilities)
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 299, in start_session
    response = self.execute(Command.NEW_SESSION, caps)["value"]
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/remote/webdriver.py", line 354, in execute
    self.error_handler.check_response(response)
  File ".../QuantumGo_Engine/.venv/lib64/python3.12/site-packages/selenium/webdriver/remote/errorhandler.py", line 229, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 114
Current browser version is 127.0.6533.99 with binary path /usr/bin/chromium-browser
Stacktrace:
#0 0x562505c524e3 <unknown>
#1 0x562505981c76 <unknown>
#2 0x5625059af04a <unknown>
#3 0x5625059aa4a1 <unknown>
#4 0x5625059a7029 <unknown>
#5 0x5625059e5ccc <unknown>
#6 0x5625059e547f <unknown>
#7 0x5625059dcde3 <unknown>
#8 0x5625059b22dd <unknown>
#9 0x5625059b334e <unknown>
#10 0x562505c123e4 <unknown>
#11 0x562505c163d7 <unknown>
#12 0x562505c20b20 <unknown>
#13 0x562505c17023 <unknown>
#14 0x562505be51aa <unknown>
#15 0x562505c3b6b8 <unknown>
#16 0x562505c3b847 <unknown>
#17 0x562505c4b243 <unknown>
#18 0x7fdb39532507 start_thread
#19 0x7fdb395b640c __clone3

Exception ignored in: <function Board.__del__ at 0x7f091075df80>
Traceback (most recent call last):
  File ".../QuantumGo_Engine/web_board.py", line 150, in __del__
    self.driver.quit()
    ^^^^^^^^^^^
AttributeError: 'Board' object has no attribute 'driver'
SameerDalal commented 2 months ago

I believe I had a similar issue at some point. My solution was to go into the folder where the webdrivers were installed and delete all the existing webdriver versions. On my system I found them here: C:\Users\<name>\.wdm\drivers\chromedriver\win64

This would make it so that ChromeDriverManager().install() will install a driver based on your current version of chrome and not use a conflicting driver in that folder which is likely causing the error. Also, if your Chrome settings allow for auto-update keeping this line ChromeDriverManager().install() will install a driver based on the new version automatically.

Glad you found a fix though!

benjaminpjones commented 2 months ago

Ah makes sense - I'm not very familiar with how these drivers are set up. Could be that the installer has trouble detecting Chromium.

Will go ahead and close if this is not an issue on other systems