python中安装好selenium包 pip install selenium
点击下载chrome的webdriver: http://chromedriver.storage.googleapis.com/index.html,目前只有32位的。
1.驱动下载完成,解压
2.将解压后文件chromedriver.exe复制到python的Scripts安装目录下(我的:E:\Python\Python36-32\Scripts),并且添加到path环境变量
3.将目录chrome的安装目录添加到path环境变量。(我的:C:\Program Files (x86)\Google\Chrome\Application\chrome.exe)
4.运行下面代码:成功打开百度即为成功:(别拉到cmd里直接运行,各种报错,我是在VS终端下调试成功的)
from selenium import webdriver
driver = webdriver.Chrome()
driver.get(‘http://www.baidu.com')
然后是详细代码:(代码转自奥哥)
seleclass.py主入口文件
1 | # -*- coding: utf-8 -*- |
image_diff.py图片处理文件
1 | from skimage.measure import compare_ssim |