Selenium webdriver Java 操作chrome 浏览器
Step1: 下载chromedriver。
下载路径: http://chromedriver.storage.googleapis.com/index.html
选择一个合适的下载即可。我下载的是2.20版本的chromedriver_win32.zip ,解压之后得到chromedriver.exe 。
Step2: 放置chromedriver.exe
在跟项目包平行的地方新建一个包,比如”lib",然后将 chromedriver.exe拷贝到lib下。

Step3: 添加 webdriver.chrome.driver 属性设置
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver; public class ChromeTest { public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","src/lib/chromedriver.exe"); WebDriver wd = new ChromeDriver();
wd.get("http://www.baidu.com");
try {
Thread.sleep(1200);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(wd.getCurrentUrl());
wd.quit(); }
}
Step4: 运行
Starting ChromeDriver 2.20.353145 (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx) on port 14153
Only local connections are allowed.
https://www.baidu.com/
Selenium webdriver Java 操作chrome 浏览器的更多相关文章
- Selenium webdriver Java 操作IE浏览器
V1.0版本:直接新建WebDriver使用 import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetE ...
- selenium webdriver python 操作Chrome浏览器
Step1: 下载chromedriver. 下载路径: http://chromedriver.storage.googleapis.com/index.html 选择一个合适的下载即可.我下载的是 ...
- selenium webdriver python 操作IE浏览器
Step1:下载IEDriverServer 下载路径:http://selenium-release.storage.googleapis.com/index.html 我下载的是2.48版本的IE ...
- [selenium webdriver Java]常用api
1. 获取元素文本 WebElement类的getText()方法返回元素的innerText属性.所以元素里如果有子节点一样也会被返回出来.如下所示 public class GetText { @ ...
- atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结
atitit.浏览器web gui操作类库 和 操作chrome浏览器的类库使用总结 1. 常见标准 1 1.1. 录制重放 1 1.2. 一个窗体一个proxy cookie 1 1.3. exec ...
- Selenium Webdriver java 积累一
Selenium Webdriver 学习: http://jarvi.iteye.com/category/203994 https://github.com/easonhan007/webdriv ...
- Selenium webdriver 操作chrome 浏览器
Step1: 下载chromedriver. 下载路径: http://chromedriver.storage.googleapis.com/index.html 选择一个合适的下载即可.我下载的是 ...
- Python3.5+selenium操作Chrome浏览器
1.安装selenium 命令提示符下输入: pip install selenium 2.下载chromedriver 点击下载 3.将解压后的chromedriver.exe放到chrome浏览器 ...
- [selenium webdriver Java]元素定位——findElement/findElements
策略 语法 语法 描述 By id driver.findElement(By.id()) driver.findElements(By.id()) 通过id属性定位元素 By name driver ...
随机推荐
- FluentValidation具体使用案例
可以使用NuGet 添加类库 下面是程序: using FluentValidation; using System; using System.Linq; namespace TestFluen ...
- rest-framework-@action()装饰器
路由Routers 使用方法: 在urls.py中定义路由 from rest_framework.routers import DefaultRouter # 定义视图集的路由 router = ...
- 关于ofbiz加载数据模块的文件参数配置
1,在applications文件夹下新建一个数据模块meetingroom 2, 要让ofbiz加载这个数据模块就需要在applications下的配置文件里修改参数 (1)在application ...
- 如何用sqlplus执行sql脚本,且让出错后及时退出sqlplus
按sqlplus常规作法,是要登陆,输入用户名和密码才能操作的. 并且,如果不作特别设置,SQL脚本里的部门语句有问题后,它还是会坚持执行完成其余的SQL的. 为了安全和自动化,得改进一下了. sql ...
- 如何php防止XSS攻击
什么是XSS:这里通俗的讲,就像是SQL注入一样,XSS攻击也可以算是对HTML和JS的一种注入.你本来希望得到是从用户那得到一段有用的文本文字,但用户提交给你的却是别有用心的可执行javascrip ...
- [BZOJ3698] XWW的难题 网络流
3698: XWW的难题 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 533 Solved: 275[Submit][Status][Discus ...
- 《javascript高级程序设计》读书小延伸
这本书已经读了几章了,想着试试能不能做出点东西,就简单的练了把手.觉得对于初学者,自己试着练练,效果还不错的. 挥刀要从轻的开始,起初的原因是和同事谈起曾经的逝水年华(小时候干的坏事)时说起了曾经的一 ...
- 洛谷 P3803 多项式乘法
题目背景 这是一道FFT模板题 题目描述 给定一个n次多项式F(x),和一个m次多项式G(x). 请求出F(x)和G(x)的卷积. 输入输出格式 输入格式: 第一行2个正整数n,m. 接下来一行n+1 ...
- 【找规律】Codeforces Round #392 (Div. 2) C. Unfair Poll
C. Unfair Poll time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- 【拓扑排序】【堆】CH Round #57 - Story of the OI Class 查错
拓扑排序,要让字典序最小,所以把栈改成堆. #include<cstdio> #include<queue> #include<algorithm> using n ...