Chromedriver selenium may have wrong permission on Mac [duplicate] - python

This question already has answers here:
'Webdrivers' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
(22 answers)
Closed 6 months ago.
I am new at Python and selenium and I want to build an webdriver or bot respectively. I tried to execute the code below with inserting "python3 main.py" and with running the code on VS code but it is not working. The error result is enclosed. I am using Mac. The chromedriver exec is in the same main folder like the code I am writing, so actually the Path should be right. I tried different ways to solve my problem but non of them worked. I have the right chromedriver version on my mac and I even allowed my system to open the chromedriver folder.
from selenium import webdriver
browser = webdriver.Chrome('/Users/user/Desktop/it_projects/python-google-automation/src/chromedriver')
browser.get('https://www.google.com')
Error: "user#MacBook-Air-von-User python-google-automation % python3 main.py
/Users/user/Desktop/it_projects/python-google-automation/main.py:4: DeprecationWarning: executable_path has been deprecated, please pass in a Service object
driver = webdriver.Chrome(executable_path='/Users/user/Desktop/it_projects/python-google-automation/src/chromedriver')
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: '/Users/user/Desktop/it_projects/python-google-automation/src/chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/user/Desktop/it_projects/python-google-automation/main.py", line 4, in <module>
driver = webdriver.Chrome(executable_path='/Users/user/Desktop/it_projects/python-google-automation/src/chromedriver')
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
self.service.start()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 86, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://chromedriver.chromium.org/home
user#MacBook-Air-von-User python-google-automation % "

#Oxgur Sahin, you have to give executable permission to your chromedriver file /Users/user/Desktop/it_projects/python-google-automation/src/chromedriver.

Related

Selenium module's webdriver.Firefox() not working [duplicate]

This question already has answers here:
WebDriverException: 'geckodriver' executable needs to be in PATH even though it is
(1 answer)
'geckodriver' executable needs to be in PATH using GeckoDriver and Firefox through Selenium
(2 answers)
Closed last year.
I will provide my code, with included error message. I believe I need to move the gecko driver to PATH, but I tried to do some research on how to do this and unfortunately I didn't find anything definitive. I'm hoping that someone could give me a hand.
from selenium import webdriver
browser = webdriver.Firefox()
Traceback (most recent call last):
File "C:\Users\lukep\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 71, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\lukep\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 966, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\lukep\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1435, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
browser = webdriver.Firefox()
File "C:\Users\lukep\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\firefox\webdriver.py", line 174, in __init__
self.service.start()
File "C:\Users\lukep\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.

Multiple errors with selenium, python and chrome [duplicate]

This question already has answers here:
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH error with Headless Chrome
(1 answer)
WebDriverException: Message: 'chromedriver' executable needs to be in PATH while setting UserAgent through Selenium Chromedriver python
(1 answer)
Closed 2 years ago.
I cant find the soluiton for this errors, the code is really simple but i can't fix it, please help
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Chrome()
driver.get("www.google.com")
driver.close()
i tried with geckodriver, and with the path in all the ways, but there's no change
Traceback (most recent call last):
File "/home/lautaro/.local/lib/python3.8/site-
packages/selenium/webdriver/common/service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'chromedriver'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/lautaro/.local/lib/python3.8/site-
packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/lautaro/.local/lib/python3.8/site-
packages/selenium/webdriver/common/service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'chromedriver'
executable needs to be in PATH. Please see
https://sites.google.com/a/chromium.org/chromedriver/home

How to correctly use selenium with Firefox? [duplicate]

This question already has answers here:
WebDriverException: 'geckodriver' executable needs to be in PATH even though it is
(1 answer)
Python 3.5 - "Geckodriver executable needs to be in PATH"
(4 answers)
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH with GeckoDriver Selenium Firefox
(2 answers)
Closed 3 years ago.
I am trying to make selenium work with Firefox 71.00 x64 en-US, the code I am entering is:
from selenium import webdriver
browser = webdriver.Firefox()
but the browser doesn't start and I keep getting this error even if I already added to the system path both geckodriver(last version downloadable) and the directory to firefox.exe:
File "C:\Users\Tommaso\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\common\service.py", line 72, in start
self.process = subprocess.Popen(cmd, env=self.env,
File "C:\Users\Tommaso\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 854, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Users\Tommaso\AppData\Local\Programs\Python\Python38\lib\subprocess.py", line 1307, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\Users\Tommaso\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\firefox\webdriver.py", line 164, in __init__
self.service.start()
File "C:\Users\Tommaso\AppData\Roaming\Python\Python38\site-packages\selenium\webdriver\common\service.py", line 81, in start
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: 'geckodriver' executable needs to be in PATH.
Fixed it by adding geckodriver.exe to the same directory as python.exe.

unable to run basic Py program in Pycharm with Selenium

I'm very new to coding. Trying to run the below basic lines from past 20 days, and getting the below error. Kindly help. Tried installing uninstalling python, selenium & pycharm. still same issue :(
My code:
from selenium import webdriver
browser = webdriver.Chrome(executable_path = 'C:\Program Files (x86)\Google\Chrome\Application')
browser.get('https://www.google.com')
browser.quit()
Error -
"C:\Python 3.7.6\python.exe" C:/Users/PycharmProjects/sel/sel1.py
Traceback (most recent call last):
File "C:\Python 3.7.6\lib\site-packages\selenium\webdriver\common\service.py", line 76, in start
stdin=PIPE)
File "C:\Python 3.7.6\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Python 3.7.6\lib\subprocess.py", line 1207, 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/PycharmProjects/sel/sel1.py", line 2, in <module>
browser = webdriver.Chrome(executable_path = 'C:\Program Files (x86)\Google\Chrome\Application')
File "C:\Python 3.7.6\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
self.service.start()
File "C:\Python 3.7.6\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: 'Application' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
Thanks in advance.
Your executable path is deeply problematic. The error being thrown show that your programs access to the chrome driver is being blocked. Change the position of the chrome driver to somewhere else(desktop, user directory etc) and change the executable path in your code to the new path where you put your chromedriver and you should be okay

Error when using "webdriver.Chrome()" in selenium [duplicate]

This question already has answers here:
Error message: "'chromedriver' executable needs to be available in the path"
(33 answers)
Closed 3 years ago.
When I use "webdriver.Chrome()". I encountering an error when running this code:
from selenium import webdriver
driver = webdriver.Chrome()
Here's the error that showes up:
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)
FileNotFoundError: [WinError 2] The system cannot find the file specified
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
driver = 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 83, in start
os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable needs to be in PATH. Please see https://sites.google.com/a/chromium.org/chromedriver/home
I don't have any idea what to make of this. And I haven't found anyone with the same issue. Anyone know a fix?
You need to chromedriver binary and the path of binary as below:
driver = webdriver.Chrome('/usr/local/bin/chromedriver.exe')
Download your chromedriver as per your chrome version from below location :
https://chromedriver.storage.googleapis.com/index.html

Categories

Resources