I'm following a tutorial on using selenium and I'm having trouble getting started. Namely, when I try to run the code below, I get the error below. I have seen other users with the same problem, I have tried their solutions, they did not work.
These solutions include:
- running pycharm as administrator,
- setting permissions for all
- group/usernames of subprocess.py and service.py
- site-package(and pretty much every file/folder within) to full access.
from selenium import webdriver
driver = webdriver.Chrome(r"C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\selenium\webdriver\chrome")
driver.get("http://python.org")
Here is the full error message:
Traceback (most recent call last): File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start stdin=PIPE) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in init restore_signals, start_new_session) File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child startupinfo) PermissionError: [WinError 5] Access is denied
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:/Users/User/PycharmProjects/PythonProject/DataCollection", line 2, in driver = webdriver.Chrome(r"C:\Users\User\AppData\Local\Programs\Python\Python37-32\Lib\site-packages\selenium\webdriver\chrome") File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in init self.service.start() File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\selenium\webdriver\common\service.py", line 88, in start os.path.basename(self.path), self.start_error_message) selenium.common.exceptions.WebDriverException: Message: 'chrome' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home