错误信息如下:
Traceback (most recent call last):
File “/home/ly/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py”, line 76, in start
stdin=PIPE)
File “/usr/lib/python3.6/subprocess.py”, line 709, in init
restore_signals, start_new_session)
File “/usr/lib/python3.6/subprocess.py”, line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
PermissionError: [Errno 13] Permission denied: ‘chromedriver’
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/home/ly/Desktop/robot/day_06/01_try_selenium.py”, line 6, in
driver = webdriver.Chrome()
File “/home/ly/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py”, line 73, in init
self.service.start()
File “/home/ly/.local/lib/python3.6/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: ‘chromedriver’ executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
Process finished with exit code 1
解决方法:
- 打开终端
whereis chromedriver # 找到chromediver
返回:chromedriver: /usr/bin/chromedriver
cd /usr/bin/chromedriver # 进入
sudo chmod +x chromedriver # 给予权限