转:使用WebDriver过程中遇到的那些问题
|
public WebDriver create() {
FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("network.proxy.type",1);
firefoxProfile.setPreference("network.proxy.http",yourProxy);
firefoxProfile.setPreference("network.proxy.http_port",yourPort);
firefoxProfile.setPreference("network.proxy.no_proxies_on","");
return new FirefoxDriver(firefoxProfile);
}
|
|
protected Function<WebDriver, Boolean> isPageLoaded() {
return new Function<WebDriver, Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
return ((JavascriptExecutor) driver).executeScript("return document.readyState").equals("complete");
}
};
}
public void waitForPageLoad() {
WebDriverWait wait = new WebDriverWait(webDriver, 30);
wait.until(isPageLoaded());
}
|
|
private Function<WebDriver, Boolean> haveMoreThanOneOption(final By element) {
return new Function<WebDriver, Boolean>() {
@Override
public Boolean apply(WebDriver driver) {
WebElement webElement = driver.findElement(element);
if (webElement == null) {
return false;
} else {
int size = webElement.findElements(By.tagName("option")).size();
return size >= 1;
}
}
};
}
public void waitForDropDownListLoaded() {
WebDriverWait wait = new WebDriverWait(webDriver, 30);
wait.until(isPageLoaded());
}
|
|
public void getScreenShot() {
if (webDriver instanceof TakesScreenshot) {
TakesScreenshot screenshotTaker = (TakesScreenshot) webDriver;
File file = screenshotTaker.getScreenshotAs(savePath);
}
}
|
转:使用WebDriver过程中遇到的那些问题的更多相关文章
- Selenium2学习-018-WebUI自动化实战实例-016-自动化脚本编写过程中的登录验证码问题
日常的 Web 网站开发的过程中,为提升登录安全或防止用户通过脚本进行黄牛操作(宇宙最贵铁皮天朝魔都的机动车牌照竞拍中),很多网站在登录的时候,添加了验证码验证,而且验证码的实现越来越复杂,对其进行脚 ...
- Web CI过程中的Security解决方案
http://www.infoq.com/cn/articles/WebScan-CI 一. 当前Web应用安全现状 随着中国互联网金融的爆发和繁荣,Web应用在其中扮演的地位也越来越重要,比如Web ...
- WINDOWS系统下MYSQL安装过程中的注意事项
1.首先MySQL的安装方式有两种:一种是MSI安装方式,很简单就像安装Windows软件一样.另外一种就是ZIP安装方式.这种相对而言比较麻烦.新手推荐MSI安装方式. 安装方式有以下两种: MSI ...
- 【转】SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误
SQL Server -- 已成功与服务器建立连接,但是在登录过程中发生错误 最近在VS2013上连接远程数据库时,突然连接不上,在跑MSTest下跑的时候,QTAgent32 crash.换成IIS ...
- zabbix 3.0.3 (nginx)安装过程中的问题排错记录
特殊注明:安装zabbix 2.4.8和2.4.6遇到2个问题,如下:找了很多解决办法,实在无解,只能换版本,尝试换(2.2.2正常 | 3.0.3正常)都正常,最后决定换3.0.3 1.Error ...
- C语言调试过程中duplicate symbol错误分析
说明:在我们调试C语言的过程中,经常会遇到duplicate symbol错误(在Mac平台下利用Xcode集成开发环境).如下图: 一.简单分析一下C语言程序的开发步骤. 由上图我们可以看出C语言由 ...
- 测试或运维工作过程中最常用的几个linux命令?
大家在测试工作过程中,可能会遇到需要你去服务器修改一些配置文件,譬如说某个字段的值是1 则关联老版本,是0则关联新版本,这时候你可能就需要会下vi的命令操作:或者查看session设置的时长,可能需 ...
- Atomikos的使用过程中要注意的事
在使用Atomikos过程中遇到的一些问题,以作记录: MySQL does not support TMJOIN MySQL does not allow for joining an existi ...
- MySQL Fabric和MyBatis的整合过程中遇到的问题
这是我昨天在整合MySQL Fabric和MyBatis时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...
随机推荐
- SharePoint 网站登录不上,3次输入用户名/密码白页、
来源于:http://www.cnblogs.com/jianyus/p/3249091.html 新搭建的SharePoint 2013环境,第一次干的这么憋屈的慌,先是接了一个Ghost的服务器, ...
- 2015 ACM/ICPC Asia Regional Shanghai Online
1001 Puzzled Elena 1002 Antonidas 1003 Typewriter 1004 Count the Grid 1005 Code Formatting 1006 Ther ...
- Java多态(二)
public class ExtendsTest { public static void main(String[] args) { A a1 = new A(); A a2 = new B(); ...
- cookie和session的区别(搜狐笔试考到的一个题目)
一.cookie机制和session机制的区别***************************************************************************** ...
- java 常用的三大集合类
一.Set集合.其主要实现类有HashSet.TreeSet.存放对象的引用,不允许有重复对象. 代码: public class SetTest { public static void main( ...
- cmd命令行
拷贝
- Code Blocks 多文件联合编译
code::blocks是一款据说灰常强大的IDE,以前虽然也经常使用,但一没用过高度功能,二来没用它写过工程性的东西,简单点说就是一个以上的源文件并且加入其他非标准的头文件,今天想做一个多文 ...
- android抓日志
1. adb logcat -c 清楚以前的日志 adb logcat -s 过滤 adb logcat -s *:E adb logcat -v 指定输出的格式 adb logcat -v brie ...
- 三层交换机配置说明(华为S5700设置三个网段互通)
1.配置Switch # 创建VLAN <HUAWEI> system-view[HUAWEI] sysname Switch[Switch] vlan batch 10 20 30# 配 ...
- linux上安装配置samba服务器
linux上安装配置samba服务器 在linux上安装配置samba服务器 在这给大家介绍一个不错的家伙,samba服务.如果您正在犯愁,如何在Windows和Linux之间实现资源共享,就请看看这 ...