selenium 安装

selenium 安装

pip install selenium

chromedriver 版本号选择

https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection

chromedriver 下载列表

https://chromedriver.storage.googleapis.com/index.html
我这里选择: 72.0.3626.69

下载好后,将 chromedriver.exe 移动到 python37/Scripts/chromedriver.exe

在 cmd 中执行

chromedriver

看到如下信息,即安装成功
Starting ChromeDriver 72.0.3626.69 (3c16f8a135abc0d4da2dff33804db79b849a7c38) on port 9515
Only local connections are allowed.
Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

vi chromedriver_test.py

from selenium import webdriver
browser = webdriver.Chrome()

python chromedriver_test.py
出现一个空白 chrome 浏览器即配置成功

如需转载,请标注来源谢谢: http://lukachen.com/archives/315/

发表新评论