selenium环境安装

你离开我真会死。 提交于 2020-02-27 19:05:32

1:下载selemium。cmd中pip install selenium
2:下载对应的浏览器驱动。谷歌:chromedriver.exe
浏览器驱动放到python安装目录下。

问题:使用驱动过程出现如下问题,是因为下载下来的驱动没有解压,将下载下来的压缩文件解压后放到python安装目录中就可以了。
Traceback (most recent call last):
File “C:\SoftwareSetup\python3.7.1\lib\site-packages\selenium\webdriver\common\service.py”, line 76, in start
stdin=PIPE)
File “C:\SoftwareSetup\python3.7.1\lib\subprocess.py”, line 769, in init
restore_signals, start_new_session)
File “C:\SoftwareSetup\python3.7.1\lib\subprocess.py”, line 1172, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Users\Administrator\Desktop\webdriver.py”, line 2, in
driver = webdriver.Chrome()
File “C:\SoftwareSetup\python3.7.1\lib\site-packages\selenium\webdriver\chrome\webdriver.py”, line 73, in init
self.service.start()
File “C:\SoftwareSetup\python3.7.1\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
utable needs to be in PATH.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!