有时候我们会将一个iframe作为编辑器使用,如iframe的内容是
<html>
<body id="editor" contentEditable="true">
</body>
</html>
包含这个iframe页面的代码是
<html>
<body>
<p>Editor</p>
<iframe id="frame1" src="frame1.htm">
</iframe>
</body>
</html>
selenium test case的代码可以这样写
selenium.type("//body[@id='editor']", "werwerwqerqwer");
assertEquals("werwerwqerqwer", selenium.getText("//body[@id='editor']"));
不需要使用selectFrame来选择要操作的iframe。对于输入的内容,有些跟HTML冲突的必须做一些转换,例如<,>,"等要转换成实体如<,>,"。例如如果要输入换行,则直接使用<br/>即可(不需要做转换),下面是一个例子
StringBuffer content = new StringBuffer();
content.append("<html>").append("<br/>");
content.append("<body>").append("<br/>");
content.append("<a href="test.jsp">link</a>")
.append("<br/>");
content.append("<br/>").append("<br/>");
content.append(
"<div class="content">hello world</div>")
.append("<br/>");
content.append("</body>").append("<br/>");
content.append("</html>").append("<br/>");
selenium.type("//body[@class='editbox']", content.toString());
实际上输入的是一段HTML文本
<html>
<body>
<a href="test.jsp">link</a>
<br/>
<div class="content">hello world</div>
</body>
</html>
相关推荐
Selenium 1.0 Testing Tools, 虽然是1.0,但是感觉写得不错,喜欢的亲们可以下载看看。
Selenium 1.0 初学者指南 基于Selenium 1.0 Testing Tools :Beginners Guide翻译
本文档描述了selenium1.0版本升级过程,因升级方法与低版本不一样,所以出此文档帮助。 环境:RIDE 0.43.3 running on Python 2.7.1.
Selenium深入浅出,是我写的Selenium中文教程,包括了参考手册和Ext下Selenium的使用,Selenium下调用JavaScript等高端使用技术。
主要是针对以selenium1.0与2.0在实际使用当中的区别进行整理
本文为selenium+python培训PPT,包含框架、测试报告、自动发送邮件等。 包含:环境部署、Selenium自动化工具介绍、UnitTest框架介绍、Python语法介绍 、Selenuim+Python实战以及常见问题。配套电子教程后续会陆续奉...
Written with a fast-paced but friendly and engaging approach, this Packt Beginner's Guide is designed to be placed alongside the computer as your guide and mentor. Step-by-step tutorials are bolstered...
Selenium1.0不能处理一下事件: 1)本机键盘和鼠标事件 2)同源策略XSS/HTTP(S) 3)弹出框,对话框(基本身份认证,自签名的证书和文件上传/下载) Selenium2.0有简洁的API,WebDriver和WebElement对象,更好的...
Selenium文档 v1.0(英文) Selenium Documentation 文档 1.0
Selenium 2,又名 WebDriver,它的主要新功能是集成了 Selenium 1.0 以及 WebDriver(WebDriver 曾经是 Selenium 的竞争对手)。也就是说 Selenium 2 是 Selenium 和 WebDriver 两个项目的合并,即 Selenium 2 兼容 ...
Packtpub.Selenium.1.0.Testing.Tools.Beginners.Guide.Nov.2010.rar
Selenium的JavaClientDriver1.0API参考手册【chm】 Selenium是一个测试Html页面的测试程序。这是使用Java编写Selenium测试的API参考。Selenium使用JavaScript的方式来控制浏览器中的html代码。实现对WEB界面的自动化...
Selenium 1.0 初学者指南.pdf Selenium私房菜(新手入门教程).pdf [零成本实现Web自动化测试-基于Selenium和Bromine].温素剑.pdf Selenium 中文文档 .pdf selenium2.0_中文帮助文档.doc 具体见附件
特点:无需编码就可以实现自动化测试,降低自动化测试的门槛 优势: 1.基于关键字驱动框架技术,脚本复用度高 2.综合应用多种识别技术,对对象识别成功率99% ...6.支持基于selenium框架的脚本编写
selenium1.0的自动化测试,selenium-remote-control-1.0.3,包含selenium-java-client-driver-1.0.1、selenium-php-client-driver-1.0.1等等
这是selenium 1.0不是WEBDRIVER。都是一些入门知识,可以用来做简单培训教材。
Selenium2.0帮助文档 第1章 Webdirver基础 2 1.1 下载selenium2.0的lib包 2 1.2 用webdriver打开一个浏览器 2 1.3 打开测试页面 2 1.4 GettingStarted 2 ...第6章 在selenium2.0中使用selenium1.0的API 14