软件测试 / 测试开发丨 Selenium 安装教程
免费领取:测试资料+性能测试+接口测试+自动化测试+测试开发+测试用例+简历模板+测试文档
Selenium 官网
www.selenium.dev/
Selenium 的三大组成部分
Selenium WebDriver
进行 UI 自动化依赖的框架
Selenium IDE
浏览器内插件,可以进行 UI 自动化录制
Selenium Gird
分布式 UI 自动化框架
Selenium 架构图

Selenium 需要环境
jdk1.8 查看方式

Maven 3.6.1 查看方式

idea
复制代码
下载相对应的包
下载对应版本的 chromedriver
chromedriver 下载

查看谷歌浏览器的 chrome 版本信息
1.先查看你的谷歌浏览器的 chrome 版本信息

进入 chrome 的设置页面,可查看 chrome 的版本信息

如何下载对应版本的 chromedriver
webdriver 入门 → 浏览器 → 选择浏览器 ->version selection 地址:https://sites.google.com/a/chromium.org/chromedriver/downloads/version-selection

https://chromedriver.storage.googleapis.com/LATEST_RELEASE_87.0.4280
87.0.4280 是你的浏览器版本号前三位。
如何查找浏览器的版本号,前面已有说明

chromedriver.storage.googleapis.com/index.html?…

可按需求下载对应的版本。
配置环境变量
环境变量配置

先在终端输入 chromedirver

(上图显示,未安装 chromedirver 时终端显示)
先打开终端,在 bash_profile 中添加如下文字
使用命令:vim ~/.bash_profile 打开
加上 chromedriver 及环境变量
复制代码

用 source ~/.bash_profile 来将环境变量重新加载。这条命令可以简单理解为:页面的刷新按钮,刷新后重新加载。
IDEA 导包

复制代码
版权声明: 本文为 InfoQ 作者【测试人】的原创文章。
原文链接:【http://xie.infoq.cn/article/ac0d2fad54c0248f75b4fd5db】。文章转载请联系作者。
评论