Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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
like image 340
Ash1x Avatar asked Nov 07 '17 02:11

Ash1x


People also ask

What is Chromedriver executable?

ChromeDriver is a separate executable that Selenium WebDriver uses to control Chrome. It is maintained by the Chromium team with help from WebDriver contributors. If you are unfamiliar with Selenium WebDriver, you should check out the Selenium site.


3 Answers

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 os is windows:

    • 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 os is linux:

    • 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 os is macos:

    • 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')
      
like image 142
undetected Selenium Avatar answered Oct 20 '22 04:10

undetected Selenium


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

like image 42
Ramana Avatar answered Oct 20 '22 04:10

Ramana


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.

like image 8
Urban P. Avatar answered Oct 20 '22 05:10

Urban P.