Selenium是一个很好用的Web界面测试框架。但它的功能也有不足之处,比如: 在Selenium IDE中不支持程序控制语句。下面介绍如何在Selenium IDE中添加程序控制功能。
1)下载Selenium插件 (sideflow.js):
如果不想下载,直接把下面的代码保存到本机也可。
var gotoLabels= {};
var whileLabels = {};
// overload the original Selenium reset function
Selenium.prototype.reset = function() {
// reset the labels
this.initialiseLabels();
// proceed with original reset code
this.defaultTimeout = Selenium.DEFAULT_TIMEOUT;
this.browserbot.selectWindow("null");
this.browserbot.resetPopups();
}
Selenium.prototype.initialiseLabels = function()
{
gotoLabels = {};
whileLabels = { ends: {}, whiles: {} };
var command_rows = [];
var numCommands = testCase.commands.length;
for (var i = 0; i < numCommands; &#