首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
selenium webdriver 赋值
2024-08-30
selenium webDriver给隐藏域赋值 input hidden set value
//直接这样无法给input hidden赋值// driver.findElement(By.id("image_default")).sendKeys("a1112.jpg"); String val = driver.findElement(By.id("image_default")).getAttribute("value"); JavascriptExecutor jse = (JavascriptExecutor
selenium webdriver (python)的基本用法一
阅在线 AIP 文档:http://selenium.googlecode.com/git/docs/api/py/index.html目录一.selenium+python 环境搭建................................................................................................61.1 selenium 介绍..............................................
selenium webdriver testng自动化测试数据驱动
selenium webdriver testng自动化测试数据驱动 selenium webdriver testng自动化测试数据驱动 一.数据驱动测试概念 数据驱动测试是相同的测试脚本使用不同的测试数据执行,测试数据和测试行为完全分离. 二.实施数据驱动测试的步骤: 1.编写测试脚本,脚本需要支持程序对象.文件或者数据库读入测试数据. 2.将测试脚本使用的测试数据存入程序对象.文件或者数据库等外部介质中. 3.运行脚本,循环调用存储在外部介质的测试数据. 4.验证所有的测试结果是否符合期望
selenium webdriver窗口切换(下)
多窗口切换有时候需要在不同的窗口切换,从而操作不同的窗口上的元素.在selenium1.0 中这个问题比较难处理.但WebDriver 提供了switcTo.window()方法可以切换到任意的窗口. 这里以百度首页与注册页为例,演示在不同窗口切换. package com.mypro.jase; import java.util.Set; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import or
Selenium WebDriver 数据驱动测试框架
Selenium WebDriver 数据驱动测试框架,以QQ邮箱添加联系人为示例,测试框架结构如下图,详细内容请阅读吴晓华编著<Selenium WebDiver 实战宝典>: ObjectMap.java /** * 使用配置文件存储测试页面上的定位和定位表达式,做到定位数据和程序的分离 */ import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import org
Selenium WebDriver UI对象库
UI对象库:使用配置文件存储测试页面上的定位和定位表达式,做到定位数据和程序的分离. 第一步:实现工具类Object工具类,供测试程序调用. /** * 使用配置文件存储测试页面上的定位和定位表达式,做到定位数据和程序的分离 */ import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import org.openqa.selenium.By; public class O
selenium webdriver从安装到使用(python语言),显示等待和隐性等待用法,切换窗口或者frame,弹框处理,下拉菜单处理,模拟鼠标键盘操作等
selenium的用法 selenium2.0主要包含selenium IDE 和selenium webDriver,IDE有点类似QTP和LoadRunner的录制功能,就是firefox浏览器的一个插件,用来录制在浏览器的一系列操作,录制完成后可以回放,可以转换为代码输出出来.本节主要讲的是selenium的webdriver功能.结合Python语言来讲解具体用法. WebDriver 的实现原理: WebDriver直接利用了浏览器的内部接口来操作浏览器. 对于不同平台中的不同浏览器,
selenium Webdriver多窗口切换
应用场景: 在页面操作过程中有时候点击某个链接会弹出新的窗口,这时候就需要主机切换到新打开的窗口上进行操作.WebDriver提供了switch_to.window()方法,可以实现在不同的窗口直接切换. 以百度首页和百度注册页为例,在两个窗口直接的切换如图 代码如下: #导包 from selenium import webdriver from time import sleep #定义浏览器句柄,打开百度网址 driver=webdriver.Chrome() driver.implici
Selenium WebDriver Code
Selenium WebDriver 用于模拟浏览器的功能,可以做网站测试用,也可以用来做crawler.我是用eclipse开发的,导入selenium-server-standalone-***.jar(Right click project -->Properties --> Java Buid Path --> Libraries --> Add External Jar...).这个包可以在Selenium官网下载. 下面的代码是简单的跟一个网站做交互: public c
使用httpclient 调用selenium webdriver
结合上次研究的selenium webdriver potocol ,自己写http request调用remote driver代替selenium API selenium web driver Json protocol 相关请看 http://www.cnblogs.com/tobecrazy/p/5020741.html 我这里使用的是Gson 和 httpclient 首先,起一个remote sever java -Dwebdriver.ie.driver="IEDriverSer
selenium webdriver 右键另存为下载文件(结合robot and autoIt)
首先感谢Lakshay Sharma 大神的指导 最近一直在研究selenium webdriver右键菜单,发现selenium webdriver 无法操作浏览器右键菜单,如图 如果我想右键另存为,根本操作不了. 也有在网上看到webdriver right click option的一些代码,拿来用发现不能用的. Actions act = new Actions(driver); WebElement link = driver.findElement(By.id("xpath"
Selenium Webdriver java 积累一
Selenium Webdriver 学习: http://jarvi.iteye.com/category/203994 https://github.com/easonhan007/webdriver_guide Selenium WebDriver经验杂记:http://blog.csdn.net/ant_yan/article/details/8185899http://blog.csdn.net/aerchi/article/category/936247 1. Selenium We
Selenium的PO模式(Page Object Model)|(Selenium Webdriver For Python)
研究Selenium + python 自动化测试有近两个月了,不能说非常熟练,起码对selenium自动化的执行有了深入的认识. 从最初无结构的代码,到类的使用,方法封装,从原始函数调用,到重定义函数.从变量驱动,到数据驱动,再到关键字驱动,一步一步的默默走向自动化框架的构建.虽然还有没有投入使用,只是写几个demo,就慢慢的发现了 selenium自动用例脚本,相似功能地方,代码基本都是一样的,界面元素换个查找方式,把原来的使用 xpath方式,改为使用 id 查找,需要对每
Selenium Webdriver下click失效问题解决
最近在使用Selenium Webdriver(Selenium2.0)进行界面自动化测试的时候发现单击事件无效,通过driver.findElement的方式是可以找到click元素的,但是就是click之后无任何反应. 研究之后发现原来是click的时候已经失去该焦点了,解决办法是先找另外的元素,再来找这个元素,例如 driver.findElement(By.linkText(name)).findElement(By.xpath("..")).click(); driver.f
如何用selenium webdriver 捕获js error
### 问题 捕捉页面上js error ### 解决办法 从Selenium webdriver log 中解析 # -*- coding:utf8 -*- import unittest from selenium import webdriver from selenium.webdriver.common.desired_capabilities import DesiredCapabilities class CaptureJSError(unittest.TestCase): @cl
Selenium WebDriver 之 PageObjects 模式 by Example
目录 1. 项目配置 2. 一个WebDriver简单例子 3. 使用Page Objects模式 4. 总结 5. Troubleshooting 6. 参考文档 本篇文章通过例子来阐述一下Selenium2.0 WebDriver 之 Page Objects模式. 项目配置 maven 3, pom.xml配置如下 <dependency> <groupId>org.seleniumhq.selenium</groupId> <artifactId>s
Selenium webdriver 操作日历控件
一般的日期控件都是input标签下弹出来的,如果使用webdriver 去设置日期, 1. 定位到该input 2. 使用sendKeys 方法 比如: 但是,有的日期控件是readonly的 比如12306的这个 <input id="train_date" class="inp-txt" type="text" value="2015-03-15" name="back_train_date" a
Selenium WebDriver 处理cookie
在使用webdriver测试中,很多地方都使用登陆,cookie能够实现不必再次输入用户名密码进行登陆. 首先了解一下Java Cookie类的一些方法. 在jsp中处理cookie数据的常用方法: getDomain():返回cookie的域名. getMaxAge():返回cookie的存活时间 getName():返回cookie的名字 getPath():返回cookie适用的路径 getSecure():如果浏览器通过安全协议发送Cookie将返回true值,如果浏览器使用标准协议刚返
selenium webdriver学习(一)
package baidu; import java.io.File; import java.io.IOException; import junit.framework.TestCase; import org.apache.commons.io.FileUtils; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.OutputType; import org.openqa.se
Selenium_用selenium webdriver实现selenium RC中的类似的方法
最近想总结一下学习selenium webdriver的情况,于是就想用selenium webdriver里面的方法来实现selenium RC中操作的一些方法.目前封装了一个ActionDriverHelper类,来实现RC中Selenium.java和DefaultSelenium.java中的方法.有一些方法还没有实现,写的方法大多没有经过测试,仅供参考.代码如下: package core; import java.io.File; import java.io.IOException
【转】Selenium WebDriver + Python 环境
转自:http://www.myext.cn/webkf/a_11878.html 1. 下载必要工具及安装包 1.1 [Python开发环境] 下载并安装Python 2.7.x版本 下载地址:https://www.python.org/downloads/ 1.2 [python 的安装包管理工具]Pip pip 是python 软件包的安装和管理工具,有了这个工具,我们只需要一个命令就可以轻松的python的任意类库. 下载地址:https://pypi.python.org/pypi/
热门专题
浏览器 插件 注入js
activeXObject 打开文件夹
k8s pod不能上网
tooltip在鼠标下边显示
visual studio 2017 社区版 许可证过期
js 点击dom包含另一个dom
如何查看cuda和cudnn的版本号
drds rds某个数据库磁盘占满导致所有数据库都不可用
swagger入参注释中文
UTC与BJT的时间换算翁恺
目录浏览关闭需要重启
java源码里面为什么这么多位运算
ios调用系统打电话 监听取消或者调用
arduino leonardo 回车
ubuntu设置vi为vim
适配pc ipad rem方案
ubuntu安装config
css滚动条的位置受padding影响
flex布局显示图片列表
android float 转string