如何让selenium 支持 XML web page
来源:互联网 发布:bt4破解软件下载 编辑:程序博客网 时间:2024/04/30 11:55
通过selenium函数读取XML的web page时,for ex."assertTrue(exceptionCodeManagement.hasText("exceptionCodeList"));", 会提示ERROR: Couldn't access document.body. Is this HTML page fully loaded?
配置完selenium-browserbot.jar后即可以通过selenium读取和验证XML网页了:
//转载自 http://www.mernin.com/blog/?p=28
If you are one of the chosen few using (or having to use) the Selenium suite of software test tools, then you may have discovered that it does not natively support XML content. Here is a useful way to modify it so that it does:
- Download the latest version in JAR format from your usual Maven repository (e.g. selenium-server-0.9.0.jar)
- Unpack this JAR somewhere on your system
- Edit the file /tmp/ss090/core/scripts/selenium-browserbot.js and locate the getBody function (line 1573 approximately)
- Modify this function as follows:
- Repack the JAR taking care to specify the correct MANIFEST file:
- If you want to produce an MD5 signature for this JAR file, you can do so using the md5sum program.
$ cd /tmp
$ mkdir ss090 ; cd ss090
$ jar xf ~/Desktop/selenium-server-0.9.0.jar
PageBot.prototype.bodyText = function() { //PageBot即是browserbot
if (this.getDocument() instanceof XMLDocument) {
return new XMLSerializer().serializeToString(this.getDocument());
} else {
return getText(this.getDocument().body);
}
};
$ cd /tmp/ss090
$ jar cfm selenium-server-xml-0.9.0.jar META-INF/MANIFEST.MF *
- 如何让selenium 支持 XML web page
- 如何让Selenium支持http basic和Digest HTTP认证
- 如何让Expat支持中文XML
- 如何让Web.xml变得简洁?
- 如何让Web.xml变得简洁?
- web.xml中的 error-page
- web.xml 配置 Error Page
- web.xml之error-page
- 如何让SharePoint 2010 Media Web Part支持更多格式
- 如何让自己的web应用支持iOS表情
- 让Expat支持中文XML
- 让IE支持XML解析
- web.xml中error-page的元素
- 在web.xml中配置error-page
- WEB.XML error-page 配置错误页面
- web.xml error-page 不起作用解决方案
- 在web.xml中配置error-page
- 在web.xml中配置error-page
- 控制后台用户的权限
- 内存泄露问题
- 导航站快速提升PR
- Android高手进阶教程(十一)之----Android 通用获取Ip的方法(判断手机是否联网的方法)!
- JS 冒泡 INPUT不可点击
- 如何让selenium 支持 XML web page
- jQuery阻止冒泡
- jquery radio取值,checkbox取值,select取值,radio选中,checkbox选中,select选中,及其相关
- jQuery-对Select的操作集合[终结篇]
- 不要迷恋哥,嫂子会揍你
- Bloom Filter概念和原理
- [Linux设备驱动第三版]小记 [1-3章]
- Zend Framework整合smarty方法
- c# DataGridView 全角