'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Asked Answered
O

21

50

I've looked around checked both documentations and have found no answer.

I've been trying to use InstaPy a instagram api for python. After failing with multiple errors and assuming InstaPy is just having some issues so i tried to raw code it using selinium. after inserting the example code and alter it to my liking i just made sure this one would work. I received a new error instead of the old one saying the permissions may not be right. I have tried reinstall and running as admin but nothing works. how do i fix this and/or what does this mean

Code:

import time
from selenium import webdriver

driver = webdriver.Chrome('C:\Webdrivers')  # Optional argument, if not specified will search path.
driver.get('http://www.google.com/xhtml');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()

Error:

Traceback (most recent call last):
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 74, in start
    stdout=self.log_file, stderr=self.log_file)
  File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 707, in __init__
    restore_signals, start_new_session)
  File "C:\Program Files (x86)\Python36-32\lib\subprocess.py", line 990, 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:\Webdrivers\RawBot.py", line 5, in <module>
    driver = webdriver.Chrome('C:\Webdrivers')  # Optional argument, if not specified will search path.
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 62, in __init__
    self.service.start()
  File "C:\Program Files (x86)\Python36-32\lib\site-packages\selenium\webdriver\common\service.py", line 86, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Ovid answered 7/11, 2017 at 2:6 Comment(0)
S
97

This error message...

WebDriverException: Message: 'Webdrivers' executable may have wrong permissions.

...implies that the ChromeDriver variant you are trying to use have wrong permissions.


You seem to have tried out:

driver = webdriver.Chrome('C:\Webdrivers')  # Optional argument, if not specified will search system $PATH variable.

A few words:

  • If your underlying is :

    • You have to download chromedriver_win32.zip from the ChromeDriver Download Location and unzip it for usage.
    • Additionally, if you are explicitly specifying the Chromedriver binary path you have to append the binary extension as well, effectively i.e. chromedriver.exe.
    • While mentioning the Chromedriver binary path you have to either use the single forward slash i.e. (/) along with the raw (r) switch or you have to use the escaped backslash i.e. (\\).
    • So your effective line of code will be :

      driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')
      
  • If your underlying is :

    • You have to download chromedriver_linux64 from the ChromeDriver Download Location and untar it for usage.
    • Additionally, if you are explicitly specifying the Chromedriver binary path you don't have to provide any extension for the executable binary, effectively i.e. chromedriver.
    • While mentioning the Chromedriver binary path you have to use the single forward slash i.e. (/).
    • So your effective line of code will be :

      driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
      
  • If your underlying is :

    • You have to download chromedriver_mac64 from the ChromeDriver Download Location and untar it for usage.
    • Additionally, if you are explicitly specifying the Chromedriver binary path you don't have to provide any extension for the executable binary, effectively i.e. chromedriver.
    • While mentioning the chromedriver binary path you have to use the single forward slash i.e. (/).
    • So your effective line of code will be :

      driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
      
Selfdelusion answered 7/11, 2017 at 6:0 Comment(1)
on windows 10 & python 3.7.1 I didn't need the raw (r) switch. Also didn't need the 'executable_path=' Not entirely sure why, link below indicates os.path.normpath corrects this. It's possible this practice has been included in webdriver.Chrome() pythonconquerstheuniverse.wordpress.com/2008/06/04/…Shreeves
A
25

This got solved when you enter the full file name which is "chromedriver.exe". Try this if you are on windows

Atomize answered 13/11, 2017 at 1:19 Comment(2)
What about Ubuntu?Rotund
@Rotund chromedriver, without the .exeStansbury
A
8

You just have to add

/chromedriver.exe

at the end of the path like this:

driver = webdriver.Chrome('C:/Users/User/Downloads/chromedriver_win32/chromedriver.exe')

Note: If you copy the path from "File Explorer" you will get:

C:\Users\User\Downloads\chromedriver_win32

You will need to use double backslashes like this:

C:\\Users\\User\\Downloads\\chromedriver_win32

so you don't get a syntax error. Or you can just use forward slashes.

Abhorrent answered 7/3, 2020 at 19:42 Comment(0)
P
7

If you are on a linux os, changing file permissions could possibly fix the problem. But beware of what you do with permissions:

chmod 755 "/path to chromedriver file"

I downloaded the file via python itself, which unfortunately disabled execution permission and this was the quick fix for it.

Presentative answered 22/6, 2020 at 10:18 Comment(0)
B
4

in Linux you need to specify the FULL path including the file itself as well, not just up to the folder (in Linux by default the downloaded file for chrome driver comes in a folder, e.g. 'chromedriver_linux64', open the folder and check the exact file name as well, usually 'chromedriver'):

from selenium import webdriver
chrome_driver_path = "/home/mn/chromedriver_linux64/chromedriver"
driver = webdriver.Chrome(executable_path=chrome_driver_path)
driver.get("https://www.amazon.com")
Brink answered 15/10, 2021 at 13:33 Comment(1)
This reply hasn't got as attention it should have. Thanks!John
E
2

if you are using chrome you must specify the full path of the chromedriver. search for the directory in which your chromedriver executable file resides. click shift+right click on the executable file. select "copy as path" and paste it in your script. don't forget to use a double backslash

so it should be:

driver = webdriver.Chrome('C:\\Utility\\BrowserDrivers\\chromedriver.exe')
Exploration answered 12/6, 2019 at 10:11 Comment(0)
A
2

If you use a Mac OS Big Sur, and Chromedriver 90+, you might have an error with the permissions of your Chromedriver.

If this is the case, it's not the file permissions that you change via "chmod," instead, it is apple-store protection that forbids the execution of the web driver.

If you like to allow this driver to be used within your Python environment or via command-line, enter:

`$ sudo xattr -r -d com.apple.quarantine  /usr/local/bin/chromedriver`
Annelleannemarie answered 1/5, 2021 at 18:1 Comment(0)
F
2

chmod 755 "/path to chromedriver file"

This has helped me

Festoonery answered 5/6, 2021 at 7:2 Comment(0)
A
1

had same issue in django.

However when I ran the same code locally (not activating my django app) it was fine and didn't have to explicitly define the path to the chrome driver.

Got around it by explicitly defining the path and the chromederiver.exe

similar to the answer above. path = "C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe"

in my case, since I want to eventually post my app I used dynamic paths

ie.

import os

BASE_oaAPP_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_oaAPP_Utilities_DIR  = os.path.join(BASE_oaAPP_DIR, 'mySubFolderInTheApp')

def utilsPathFileName(fileName):
    return os.path.join(BASE_oaAPP_Utilities_DIR, fileName)

chrome_path = utilsPathFileName('chromedriver.exe')
driver = webdriver.Chrome(chrome_path)
Artur answered 31/10, 2019 at 3:50 Comment(0)
R
1

WINDOWS : Giving complete file path solved problem.

Many tutorials and articles are recorded with previous versions, where you just give directory path containing web drivers. But now you also have to provide specific driver path you're using.

Instead of C:/WebDrivers give complete file path as C:/WebDrivers/chromedriver.exe

Rheo answered 24/12, 2020 at 7:58 Comment(0)
P
1

The same problem. My solution was in Linux os, Pycharm editor...

  1. Make sure your webdriver file with other python files (such as selinum_driver.py)
  2. Then just copy the path and paste it into your webdriver.Chrome('path')
  3. Don't need to write webdriver.exe

driver = webdriver.Chrome('/home/raju/Documents/Python-selenium/chromedriver')

Prophets answered 27/9, 2021 at 6:51 Comment(0)
C
1

For WINDOWS 10: I ran into a similar situation with the same error message when running my test code in Visual Studio Code. What solved it for me was to close out of the VS Code app and re-open the app as an administrator via the right-click menu.

Casebook answered 27/9, 2021 at 18:22 Comment(0)
S
0

For me, none of the answers above worked. But moving the chromedriver.exe to a new path (desktop in my case) solved it.

path = "C:/Users/YOUR_USER/Desktop/chromedriver/chromedriver.exe"
Sleepless answered 4/8, 2019 at 10:15 Comment(0)
R
0

I got the same error when wrongly installed drives(when for mac was downloaded windows drivers) once I correct it worked fine

Rancor answered 10/1, 2020 at 19:49 Comment(0)
G
0

You need to add exe at the end of the path of driver and it works.

Goeselt answered 12/1, 2020 at 18:53 Comment(0)
D
0

locate your installed driver.exe, shift+right click, copy as path, paste it to your IDE

Delude answered 29/2, 2020 at 19:52 Comment(0)
J
0

we can fix this issue for centos

#Install package chromedriver. Install it using yum    
yum install chromedriver

#Import following package in python.
from selenium import webdriver

#Add following options before initializing the webdriver
chromeOptions = webdriver.ChromeOptions()
chromeOptions.add_argument("--headless")
chromeOptions.add_argument("--remote-debugging-port=9222")
chromeOptions.add_argument('--no-sandbox')
driver = webdriver.Chrome('/usr/bin/chromedriver',chrome_options=chromeOptions)
Julietajulietta answered 30/7, 2020 at 13:25 Comment(0)
L
0

If you run it on a Windows computer you can also add it to Windows PATH (environment variables) so you don't have to declare executable_path. You can just say: webdriver.Chrome(options=your_options)

Longueur answered 22/1, 2021 at 18:48 Comment(0)
F
0

I got his error for MacOs and on changing the path to the one given below, the issue was solved.

driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
Flunk answered 25/1, 2021 at 21:53 Comment(2)
Can you expand on why you think this solves the problem?Deadly
I was initially using executable path = path, as chromedriver was already installed in the project path. I got error for that. On checking the Chromedriver [chromedriver.chromium.org/getting-started] docs, it was mentioned that the notation for selecting path is different for different programming languages as well as the extensions. eg, in windows it ends with .exe, but in Mac, it does notFlunk
N
0

Windows users and visual studio code: while mentioning the Chromedriver binary path you have to either use the single forward slash i.e. (/) along with the raw (r) switch or you have to use the escaped backslash i.e. (\). as well use the exact path and add chromedriver.exe at the end of the path to point directly to the executable:

driver = webdriver.Chrome(executable_path=r'C:/path/to/chromedriver.exe')

or:

driver = webdriver.Chrome(r'C:\\Users\\wanja\\Downloads\\Compressed\\chromedriver_win32\\chromedriver.exe')
Nejd answered 2/3, 2022 at 8:26 Comment(0)
T
0

this error means that file chromedriver is not executable, I fix this error with run command of (in linux):

sudo chmod +777 chromedriver

It means to make the file executable by everyone with access.

Terenceterencio answered 19/8, 2022 at 4:23 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Doorsill

© 2022 - 2024 — McMap. All rights reserved.