转:使用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时遇到的问题,花了大半天才解决的问题,解决的过程中在网上查找了很久,都没有找到解决的方案.现在记下来,希望能够帮助有同样问题的朋友.如果各位朋友 ...
随机推荐
- CVE-2014-4115漏洞分析(2014.11)
CVE-2014-4115漏洞分析 一.简介 该漏洞是由于Windows的Fastfat.sys组件在处理FAT32格式的硬盘分区存在问题.攻击者利用成功可导致权限提升. 影响的系统包括: Windo ...
- 四、oracle 用户管理(Profile)
oracle 用户管理 :profile + tablespace + role + user 一.使用profile管理用户口令概述:profile是口令限制,资源限制的命令集合,当建立数据库时, ...
- 答辩系统bug修改记录
1.验证码不显示 参考Could not initialize class sun.awt.X11GraphicsEnvironment解决 在catalina.sh里加上一句 “CATALINA_O ...
- 50、matplotlib画图示例
1.画饼图 import matplotlib.pyplot as plt >>> labels = 'frogs','hogs','dogs','logs' >>> ...
- HttpWatch工具简介及使用技巧(转载)
一 概述: HttpWatch强大的网页数据分析工具.集成在Internet Explorer工具栏.包括网页摘要.Cookies管理.缓存管理.消息头发送/接受.字符查询.POST 数据和目录管理功 ...
- 记一次Jquery获取值的典型错误
直接上代码: 代码很简单,通过Post的形式提交参数,但是发现提交的data总是空,昨晚有点纳闷,今天一看才发现... 获取值得时候的顺序有问题,获取值应该是在onclick事件中. 综上:写Jque ...
- H5的新应用-拖到页面上的元素
-------------------------- <script type="text/javascript"> // ...
- how to download image from any web page in java 下载图片
http://stackoverflow.com/questions/5882005/how-to-download-image-from-any-web-page-in-java (throws I ...
- xcode单步调试快捷键
xcode单步调试快捷键f6,但是磨人f6是用来调节键盘亮度的,在系统偏好,键盘设置里面,做如下设置就可以了.
- 修改NavigationBar样式
iOS Tip: Change Status Bar Icon & Text Colors When iOS 7 was introduced Apple allowed your appli ...