I've been programming in python for a couple weeks now on my laptop, but I was hoping to run a program using selenium on my pc. I downloaded chromedriver and tried to run it, but I keep getting this error.
from selenium import webdriverdriver = webdriver.Chrome()driver.get('google.com')
---------------------------------------------------------------------------JSONDecodeError Traceback (most recent call last)File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\selenium_manager.py:137, in SeleniumManager.run(args) 136 stderr = completed_proc.stderr.decode("utf-8").rstrip("\n")--> 137 output = json.loads(stdout) 138 result = output["result"]File ~\AppData\Local\anaconda3\Lib\json\__init__.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 343 if (cls is None and object_hook is None and 344 parse_int is None and parse_float is None and 345 parse_constant is None and object_pairs_hook is None and not kw):--> 346 return _default_decoder.decode(s) 347 if cls is None:File ~\AppData\Local\anaconda3\Lib\json\decoder.py:337, in JSONDecoder.decode(self, s, _w) 333 """Return the Python representation of ``s`` (a ``str`` instance 334 containing a JSON document). 335 336 """--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end()) 338 end = _w(s, end).end()File ~\AppData\Local\anaconda3\Lib\json\decoder.py:355, in JSONDecoder.raw_decode(self, s, idx) 354 except StopIteration as err:--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None 356 return obj, endJSONDecodeError: Expecting value: line 1 column 1 (char 0)The above exception was the direct cause of the following exception:WebDriverException Traceback (most recent call last)File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\driver_finder.py:38, in DriverFinder.get_path(service, options) 37 try:---> 38 path = SeleniumManager().driver_location(options) if path is None else path 39 except Exception as err:File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\selenium_manager.py:103, in SeleniumManager.driver_location(self, options) 101 args.append(value)--> 103 output = self.run(args) 105 browser_path = output["browser_path"]File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\selenium_manager.py:140, in SeleniumManager.run(args) 139 except Exception as err:--> 140 raise WebDriverException(f"Unsuccessful command executed: {command}") from err 142 for item in output["logs"]:WebDriverException: Message: Unsuccessful command executed: C:\Users\Ben\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\windows\selenium-manager.exe --browser chrome --output jsonThe above exception was the direct cause of the following exception:NoSuchDriverException Traceback (most recent call last)Cell In[13], line 2 1 from selenium import webdriver----> 2 driver = webdriver.Chrome() 3 driver.get('google.com')File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\chrome\webdriver.py:45, in WebDriver.__init__(self, options, service, keep_alive) 42 service = service if service else Service() 43 options = options if options else Options()---> 45 super().__init__( 46 browser_name=DesiredCapabilities.CHROME["browserName"], 47 vendor_prefix="goog", 48 options=options, 49 service=service, 50 keep_alive=keep_alive, 51 )File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\chromium\webdriver.py:49, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, options, service, keep_alive) 37 """Creates a new WebDriver instance of the ChromiumDriver. Starts the 38 service and then creates new WebDriver instance of ChromiumDriver. 39 (...) 45 - keep_alive - Whether to configure ChromiumRemoteConnection to use HTTP keep-alive. 46 """ 47 self.service = service---> 49 self.service.path = DriverFinder.get_path(self.service, options) 50 self.service.start() 52 executor = ChromiumRemoteConnection( 53 remote_server_addr=self.service.service_url, 54 browser_name=browser_name, (...) 57 ignore_proxy=options._ignore_local_proxy, 58 )File ~\AppData\Local\anaconda3\Lib\site-packages\selenium\webdriver\common\driver_finder.py:41, in DriverFinder.get_path(service, options) 39 except Exception as err: 40 msg = f"Unable to obtain driver for {options.capabilities['browserName']} using Selenium Manager."---> 41 raise NoSuchDriverException(msg) from err 43 if path is None or not Path(path).is_file(): 44 raise NoSuchDriverException(f"Unable to locate or obtain driver for {options.capabilities['browserName']}")NoSuchDriverException: Message: Unable to obtain driver for chrome using Selenium Manager.; For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors/driver_location
I've tried different chromedriver versions, but nothing seems to work. When I run the same script on my laptop it runs perfectly.