webdriver_manager icon indicating copy to clipboard operation
webdriver_manager copied to clipboard

JSONDecodeError in ChromeDriverManager().install()

Open hebozhe opened this issue 2 years ago • 2 comments

cd_service_obj = Service(ChromeDriverManager().install())
  File "C:\...\my_venv\lib\site-packages\webdriver_manager\chrome.py", line 39, in install  
    driver_path = self._get_driver_path(self.driver)
  File "C:\...\my_venv\lib\site-packages\webdriver_manager\core\manager.py", line 26, in _get_driver_path
    binary_path = self.driver_cache.find_driver(driver)
  File "C:\...\my_venv\lib\site-packages\webdriver_manager\core\driver_cache.py", line 101, 
in find_driver
    metadata = self.get_metadata()
  File "C:\...\my_venv\lib\site-packages\webdriver_manager\core\driver_cache.py", line 135, 
in get_metadata
    return json.load(outfile)
  File "C:\Users\myself\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
  File "C:\Users\myself\AppData\Local\Programs\Python\Python310\lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "C:\Users\myself\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Users\myself\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I chucked and rebuit my entire virtual environment, to no effect.

hebozhe avatar Sep 16 '22 07:09 hebozhe

can you try:

from webdriver_manager.chrome import ChromeDriverManager
webdriver.Chrome(service=Service(ChromeDriverManager().install()))

mouadessalim avatar Sep 19 '22 14:09 mouadessalim

can you try:

from webdriver_manager.chrome import ChromeDriverManager
webdriver.Chrome(service=Service(ChromeDriverManager().install()))

I didn't mess up the install command. The traceback clearly shows one line below where my snippet begins that webdriver_manager\chrome.py was accessed and started throwing its error there.

hebozhe avatar Sep 19 '22 22:09 hebozhe

I got this problem too.

sddzcuigc avatar Jan 07 '23 10:01 sddzcuigc

Please attach to issues

  • full console log of webdriver-manager with enabled WDM_LOG
  • code sample to reproduce
  • browser versions installed
  • OS version

aleksandr-kotlyar avatar Jan 08 '23 06:01 aleksandr-kotlyar

Please attach to issues

  • full console log of webdriver-manager with enabled WDM_LOG
  • code sample to reproduce
  • browser versions installed
  • OS version

@hebozhe clarifications needed.

aleksandr-kotlyar avatar Feb 05 '23 14:02 aleksandr-kotlyar

I got the root cause of your issue, @hebozhe Somehow you got broken drivers.json file on your environment. Most likely someone edited it manually. Please clean all .wdm folders and other places you could save webdrivers by webdriver-manager. And version 3.8.5+ please. 3.8.5 is latest stable for now.

aleksandr-kotlyar avatar Feb 12 '23 13:02 aleksandr-kotlyar