Home > database >  How do I downgrade my Chrome Version from version 94.0.4606.71 to version 94.0.4606.61
How do I downgrade my Chrome Version from version 94.0.4606.71 to version 94.0.4606.61

Time:10-07

I am working on a Voice assistant using Python. I keep getting this error while running my code...

Traceback (most recent call last):
  File "C:\Users\Admin\PycharmProjects\pythonProject\Python_Bot.py", line 40, in <module>
    browser_driver.get('https://www.youtube.com/')
  File "C:\Users\Admin\Python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 333, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Users\Admin\Python3.9\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\Admin\Python3.9\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: chrome not reachable
  (Session info: chrome=94.0.4606.71)

From the Session info: chrome=94.0.4606.71 message, I found out that I'm using Chrome version 94.0.4606.71 when my driver version is 94.0.4606.61. (I used Selenium's Chrome driver manager to find out my Chrome Driver version) My selenium version is up to date btw. So I'm wondering if downgrading the Chrome version from my current version to the version of my driver would get rid of this error. If that's the solution how do I downgrade Chrome safely without facing any issues? If downgrading Chrome isn't the solution, then what is? Btw I asked a similar question over here.

(The code for my Voice assistant if it's required...)

import datetime
import webbrowser
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from webdriver_manager.chrome import ChromeDriverManager
import speech_recognition as sr
import pyttsx3
import pyaudio
import os
import random
import gtts



browser_driver = webdriver.Chrome(ChromeDriverManager().install())
r1 = sr.Recognizer()
r2 = sr.Recognizer()
r3 = sr.Recognizer()

engine = pyttsx3.init()
voices = engine.getProperty('voices')
engine.setProperty('voice', voices[0].id)

with sr.Microphone() as source:
 print('Listening...')
 engine.say("Hey I'm your bot, Trevor! What can I do for you today?")
 engine.runAndWait()
 audio = r3.listen(source)

# From here

if 'YouTube' in r2.recognize_google(audio):
    r2 = sr.Recognizer()

    with sr.Microphone() as source:

        print("What do you want to see?", end='')
        audio = r2.listen(source)
        keyword = audio
        browser_driver.get('https://www.youtube.com/')
        elem = browser_driver.find_element_by_id('search')
        elem.send_keys(keyword , Keys.RETURN)

        browser_driver.quit()

    try:
        get = r2.recognize_google(audio)
        print(get)
    except sr.UnknownValueError:
        print('Error on your side')
    except sr.RequestError:
        print('Error on my side')

# Till here is the code to run a YouTube vid

PS: Both the code and the error message are indented as per Pycharm's indentation

I've been facing this issue for days now so I would really appreciate some help...

CodePudding user response:

It seems you're calling the web driver in the wrong way.

Try:

from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options

service = Service('theWebDriverPATH\\chromedriver.exe')
chrome_options = Options()
chrome_options.add_argument \
        (r"--user-data-dir=C:\\Users\\yourWindowsUser\\AppData\\Local\\Google\\Chrome\\User Data")
chrome_options.add_argument(r'--profile-directory=ThePofileYouWantToUse')
driver = webdriver.Chrome(service=service, options=chrome_options)

If you have the correct version of the web driver as you mentioned, it should work

Take note that theWebDriverPATH should be something in the form of C:\\Users\\nicoc\\PycharmProjects

EDIT I would suggest updating both Chrome and the driver at the latest version available (currently 94.0.4606.71 and 95.0.4638.17) to avoid issues

  • Related