How can I fix this error/issue in my program when using selenium

Question:

A couple of months ago, I made a program that redirects you to a certain website on google chrome(I installed a chrome driver so Selenium would work for google chrome). Everything was working properly as I tested it multiple times, But then I had to focus on school so I postponed the completion of the program. So a couple of days ago, I had some free time; so I used it to try completing the program I was working on, and so I ran the program and I keep ending up with this error:

Traceback (most recent call last):
  File "/Users/boogytoogy/Desktop/Programming /Python/Other.py", line 25, in <module>
    driver = webdriver.Chrome()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super(WebDriver, self).__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py", line 93, in __init__
    RemoteWebDriver.__init__(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 266, in __init__
    self.start_session(capabilities, browser_profile)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 357, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 418, in execute
    self.error_handler.check_response(response)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 243, 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 89
Current browser version is 95.0.4638.69 with binary path /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
Stacktrace:
0   chromedriver                        0x0000000104c7cb59 chromedriver + 2595673
1   chromedriver                        0x0000000105330b33 chromedriver + 9624371
2   chromedriver                        0x0000000104a2c773 chromedriver + 169843
3   chromedriver                        0x0000000104a50bf6 chromedriver + 318454
4   chromedriver                        0x0000000104a4cdc4 chromedriver + 302532
5   chromedriver                        0x0000000104a4a032 chromedriver + 290866
6   chromedriver                        0x0000000104a7d234 chromedriver + 500276
7   chromedriver                        0x0000000104a784f3 chromedriver + 480499
8   chromedriver                        0x0000000104a52cd6 chromedriver + 326870
9   chromedriver                        0x0000000104a53ba7 chromedriver + 330663
10  chromedriver                        0x0000000104c4ab09 chromedriver + 2390793
11  chromedriver                        0x0000000104c57bcc chromedriver + 2444236
12  chromedriver                        0x0000000104c576ee chromedriver + 2442990
13  chromedriver                        0x0000000104c31832 chromedriver + 2287666
14  chromedriver                        0x0000000104c5863f chromedriver + 2446911
15  chromedriver                        0x0000000104c40299 chromedriver + 2347673
16  chromedriver                        0x0000000104c6f8b9 chromedriver + 2541753
17  chromedriver                        0x0000000104c82008 chromedriver + 2617352
18  libsystem_pthread.dylib             0x00007fff204f28fc _pthread_start + 224
19  libsystem_pthread.dylib             0x00007fff204ee443 thread_start + 15

So Apparently, I am stuck on this error for this program which I have been trying so hard to fix. I have tried uninstalling both the chrome driver and the selenium module but it was to no avail.
So can you please help me fix this error. Thank You!

The Code:

from selenium import webdriver
import time
import sys

def welcome():
    global variables
print("Welcome to the Multi-Method Quiz")                    #I will be testing the features of the program
time.sleep(2)
print("Choose what you want to play, you will have 10 minutes time to finish either of those")
time.sleep(4)
print("A Quiz on Quizizz(1) or simple true or false quiz(2)")
try:
    opts = int(input("option 1 or option 2: "))
except ValueError:
    print("No number detected")
if opts != 1 and opts != 2:
    while True:
        print("Invalid, Please Re-run the Program")
        break

def options():
    global variables
if opts == 1:
    print("You will be redirected to the website, then simply press Play to start the quiz")
    driver = webdriver.Chrome()
    driver.get("https://quizizz.com/join/quiz/5d77ea5699886d0020d1f3ad/start")
    time.sleep(600)
    driver.quit()
Asked By: ANONBxlyn

||

Answers:

You have chromedriver version 89, which is old and does not match with your current chrome browser version 95.0.4638.69. Please update your chromedriver.

I would recommend using the below approach so that you don’t have to update chromedriver every time it is updated.

Automatic download of appropriate chromedriver for Selenium in Python

Answered By: supputuri