Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
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')
selenium.common.exceptions.WebDriverException: Message: 'WebScraping' executable may have wrong permissions
A couple of things here:
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 :
chrome_driver_path = r'C:/Users/thangtruong/WebScraping/chromedriver.exe'
service = ChromeService(executable_path=chrome_driver_path)
driver = webdriver.Chrome(service=service)
website = "https://www.amazon.com"
driver.get(website)
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 :
chrome_driver_path = '/Users/thangtruong/WebScraping/chromedriver'
service = ChromeService(executable_path=chrome_driver_path)
driver = webdriver.Chrome(service=service)
website = "https://www.amazon.com")
driver.get(website)
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 :
chrome_driver_path = '/Users/thangtruong/WebScraping/chromedriver'
service = ChromeService(executable_path=chrome_driver_path)
driver = webdriver.Chrome(service=service)
website = "https://www.amazon.com"
driver.get(website)
References
You can find a couple of detailed discussions in:
- 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Selenium on MAC, Message: 'chromedriver' executable may have wrong permissions
The error says it all :
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
The error clearly mentions that the chromedriver which is getting detected have wrong permissions.
Solution
- Download the latest chromedriver binary from ChromeDriver - WebDriver for Chrome and save it in your system.
- Ensure that chromedriver binary have the required permissions.
While initiating the WebDriver and WebClient pass the argument executable_path along with the absolute path of the chromedriver binary as follows :
from selenium import webdriver
link = "https://accounts.google.com"
driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver.get(link)
Reference
You can find a detailed relevant discussion in:
- 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
WebDriverException: Message: 'chromedriver.exe' executable may have wrong permissions using Google Colaboratory through Selenium Python
Google Colaboratory
Colaboratory is a free Jupyter notebook environment that requires no setup and runs entirely in the cloud which enables us to write and execute code, save and share your analyses, and access powerful computing resources, all for free from your browser.
The entire colab runs in a cloud VM. If you investigate the VM you will find that the current colab notebook is running on top of Ubuntu 18.04.3 LTS.
So while using Selenium instead of mentioning the WebDriver variant along with the extension i.e. .exe
you need to drop the extension. So effectively your code block will be:
import selenium
from selenium import webdriver
wd = webdriver.Chrome('/content/chromedriver')
Update
Incase you aren't sure where the ChromeDriver is getting downloaded you can move it to a known location and use it as follows:
!apt-get update
!apt install chromium-chromedriver
!cp /usr/lib/chromium-browser/chromedriver /usr/bin
!pip install selenium
from selenium import webdriver
wd = webdriver.Chrome('/usr/bin/chromedriver')
References
You can find a couple of detailed relevant discussions in:
- 'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
- Selenium on MAC, Message: 'chromedriver' executable may have wrong permissions
WebDriverException: 'chromedriver.exe' executable may have wrong permissions
I've finally managed to figure out where I went wrong.
While I had the PATH and all correct - the Chromdriver.exe file was not in my Python/scripts folder.
After setting it there, re-placing the PATH, all works well!! :)
Chromedriver executable may have wrong permissions
Instead of configuring the chrome driver manually.You can use webdriver-manager, this will automatically download and set the path of the driver location.
You can get it from pip,
pip install webdriver-manager
Now you simply call ChromeDriverManager().install()
to do it automatically. Instead of worrying about the path.
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument("--disable-extensions")
chrome_options.add_argument("--incognito")
browser = webdriver.Chrome(executable_path=ChromeDriverManager().install(), chrome_options=chrome_options)
How to fix error Message: 'chromedriver.exe' executable may have wrong permissions
It might be because of platform and chromedriver format mismatch. For example windows requires chromedriver.exe while there are different formats for linux and mac. If you don't want to install through package manager, just download chromedriver from sites.
https://sites.google.com/a/chromium.org/chromedriver/downloads
If still you get error then Goto /usr/bin
directory and you would need to run something like chmod a+x chromedriver
to mark it executable.
Related Topics
How to Compare Version Numbers in Python
Split a String by Spaces -- Preserving Quoted Substrings -- in Python
Install a Module Using Pip for Specific Python Version
How to Get User Ip Address in Django
Using Python Requests with JavaScript Pages
How Are Post and Get Variables Handled in Python
What Does %S Mean in a Python Format String
How to Plot One Line in Different Colors
How to Display Pandas Dataframe of Floats Using a Format String for Columns
Splitting a List into N Parts of Approximately Equal Length
How to Use a Python Script in the Command Line Without Cd-Ing to Its Directory? Is It the Pythonpath
How to Check If a String Contains an Element from a List in Python
Python List VS. Array - When to Use
Rewrite Multiple Lines in the Console