1. 环境准备html
须要有 chrome 浏览器 + chrome driver + selenium 客户端java
离线 chrome 下载地址linux
# 64位 linux 系统 https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm # 64位 weindow 系统 http://www.google.cn/chrome/browser/desktop/index.html?standalone=1&platform=win64 # 32位 weindow 系统 http://www.google.cn/chrome/browser/desktop/index.html?standalone=1&platform=win # 官网 chromedriver http://chromedriver.storage.googleapis.com/index.html # 淘宝 chromedriver 镜像 https://npm.taobao.org/mirrors/chromedriver/
说明:chrome 和 chromedriver 版本须要一致spring
1.2 查看 chrome 版本信息。在chrome浏览器输入如下地址chrome
chrome://version/
1.3 例如我选择的是npm
2. 将 chromedriver 放到 chrome 安装目录下api
3. 在 springboot 项目中引入 selenium 依赖浏览器
<dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>selenium-java</artifactId> <version>3.141.59</version> </dependency>
4 springboot
参考文献:google
https://blog.csdn.net/l707268743/article/details/80942246
https://www.cnblogs.com/sqy123/p/9057348.html#_labelTop
https://www.cnblogs.com/lfri/p/10542797.html