前几天学习selenium,安装Chromedriver,应为是Mac系统,一切按照安装教程都比较顺利,pycharm运行没问题,但是在Python3.7.5 IDLE运行就报错(有点强迫症),还是想弄清楚再继续学习。

代码:

from selenium import webdriver

browser=webdriver.Chrome()

报错:

Traceback (most recent call last):

  File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/common/service.py”, line 76, in start

    stdin=PIPE)

  File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py”, line 800, in init

    restore_signals, start_new_session)

  File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/subprocess.py”, line 1551, in _execute_child

    raise child_exception_type(errno_num, err_msg, err_filename)

FileNotFoundError: [Errno 2] No such file or directory: ‘chromedriver’: ‘chromedriver’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File “/Users/wangguangtao/Desktop/ceshi.py”, line 3, in

    browser=webdriver.Chrome()

  File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/selenium/webdriver/chrome/webdriver.py”, line 73, in init

    self.service.start()

  File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/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

求大神指教!!!

文章来源于互联网,如有雷同请联系站长删除:Mac 安装Chromedriver运行IDLE报错

发表评论