python使用selenium调用Chrome浏览器webdriver

python3.6+Selenium3.141环境
操作系统:Win10 x64
python 3.6
selenium 3.141
chrome驱动下载
http://chromedriver.storage.googleapis.com/index.html
http://npm.taobao.org/mirrors/chromedriver/
例子:
Chrome浏览器:Chrome v79.0.3945.36
http://www.yxpp.cn/xiazai/47019.html#xzdz
对应驱动:
http://npm.taobao.org/mirrors/chromedriver/79.0.3945.36/


下载后将文件放在\python\Scripts下,

创建hello.py脚本,如下:
from selenium import webdriver
driver = webdriver.Chrome()
driver.get("http://www.so.com")
assert "360搜索" in driver.title
print (driver.title)
driver.close()
执行这段脚本,看看是否成功调用Chrome浏览器执行selenium。执行效果如图:

猜你喜欢

转载自blog.csdn.net/fen_fen/article/details/104185695