1

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 % "
Marcel Wilson
  • 3,842
  • 1
  • 26
  • 55
  • You may find your solution here. [SO archive thread](https://stackoverflow.com/questions/49787327/selenium-on-mac-message-chromedriver-executable-may-have-wrong-permissions) – Anand Gautam Aug 12 '22 at 12:39

1 Answers1

0

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

ketanvj
  • 511
  • 4
  • 5