代码如下

from selenium import webdriver

driver=webdriver.Chrome("/Users/lucyxu/Downloads/chromedriver")
driver.get("http://www.baidu.com")

报错代码如下:

/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py --multiproc --qt-support --client 127.0.0.1 --port 51792 --file /Users/lucyxu/automation/klmwapnew/test/test.py
pydev debugger: process 1101 is connecting

Connected to pydev debugger (build 143.1559)
Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 2407, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1798, in run
    launch(file, globals, locals)  # execute the script
  File "/Users/lucyxu/automation/klmwapnew/test/test.py", line 3, in <module>
    driver=webdriver.Chrome("/Users/lucyxu/Downloads/chromedriver")
  File "/Library/Python/2.7/site-packages/selenium/webdriver/chrome/webdriver.py", line 62, in __init__
    self.service.start()
  File "/Library/Python/2.7/site-packages/selenium/webdriver/common/service.py", line 76, in start
    os.path.basename(self.path), self.start_error_message)
selenium.common.exceptions.WebDriverException: Message: 'chromedriver' executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home

Exception AttributeError: "'Service' object has no attribute 'process'" in <bound method Service.__del__ of <selenium.webdriver.chrome.service.Service object at 0x10489cb50>> ignored

因为找了很久,这个问题没有得到解决,故请解决过这个问题的朋友施以援手,万分感谢


↙↙↙阅读原文可查看相关链接,并与作者交流