0
votes

Code:

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome(executable_path = r"C:\Users\Dell\Desktop\chromedriver.exe")
driver.get("http:/https://stackoverflow.com/")

Traceback (most recent call last): File "C:\Users\Dell\Desktop\Intro.py", line 3, in driver = webdriver.Chrome(executable_path = r"C:\Users\Dell\Desktop\chromedriver.exe") File "C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in init RemoteWebDriver.init( File "C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init self.start_session(capabilities, browser_profile) File "C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.WebDriverException: Message: unknown error: failed to write prefs file

2

2 Answers

0
votes

This can cause if your C drive has not enough space. So use any tools like Disk Cleaner or CCleaner to free up some space.

0
votes

Here is my version of the working code.

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

driver = webdriver.Chrome(executable_path="C:\Windows\chromedriver.exe")
driver.get("https://stackoverflow.com/")

Try adding chromedriver to C:\Windows. Check both chrome and chromedriver having the same version.