Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ValueError: Could not get version for Chrome with this command: reg query

I am using selenium with python and have downloaded the chromedriver for my windows computer from this site. After downloading the zip file, I unpacked the zip file to my downloads folder. Then I add the path to the the Environment Variable "Path".

I want to get information from the site, but when I run code, I get this error and comletely don't understand what is it about.

from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
browser = webdriver.Chrome(ChromeDriverManager().install())
url = 'any_url'
browser.get(url)

if browser.find_element_by_id("yearlist_1").get_attribute("type") == "checkbox":
    print("Element is a checkbox")
else:
    print("Element is not a checkbox")

The error: *'reg' is not recognized as an internal or external command, operable program or batch file.

Traceback (most recent call last):
  File "C:/Users/miair/Python/script_gks/code_for_ticks.py", line 4, in <module>
    browser = webdriver.Chrome(ChromeDriverManager().install())
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\chrome.py", line 28, in install
    driver_path = self.download_driver(self.driver)
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\manager.py", line 36, in download_driver
    driver_version, is_latest = self.__get_version_to_download(driver)
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\manager.py", line 27, in __get_version_to_download
    return self.__get_latest_driver_version(driver), True
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\manager.py", line 21, in __get_latest_driver_version
    return driver.get_latest_release_version()
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\driver.py", line 58, in get_latest_release_version
    self._latest_release_url + '_' + chrome_version(self.chrome_type))
  File "C:\Program Files\Python37\lib\site-packages\webdriver_manager\utils.py", line 114, in chrome_version
    .format(cmd)
ValueError: Could not get version for Chrome with this command: reg query "HKEY_CURRENT_USER\Software\Google\Chrome\BLBeacon" /v version*

Sorry, I am very new to Python, but if somebody could help, I'll be very pleased and thankful.

like image 715
Elena Tereshchenko Avatar asked May 16 '20 14:05

Elena Tereshchenko


People also ask

Could not get version for Google Chrome is Google Chrome installed Colab?

1 Answer. Or just set google-chrome location into the PATH and then 'google-chrome --version' will start to work. Confirming the same issue in Google Colab environment.

What version of Chrome do I have Windows command line?

Run "%UserProfile%\\AppData\\Local\\Google\\Chrome\\Application\\chrome --version".


1 Answers

I solved problem. I don't understand why I've hadn't think of this solution before - all you need to do is to write the path of your chromedriver (only if you have a correct version)
browser = webdriver.Chrome('path')

like image 59
Elena Tereshchenko Avatar answered Oct 11 '22 14:10

Elena Tereshchenko