我们谷歌寻找解决方案,但不能成功,我们如何将已经录制的脚本添加到新脚本中。
发布于 2013-08-30 20:09:26
Selenium-Core有一个扩展:"include",它可以将另一个测试的内容添加到当前测试中。这是它在OpenQA维基上的页面:http://wiki.openqa.org/display/SEL/include,但不幸的是目前它还无法访问。我过去经常使用它,但最终放弃了它,转而使用汇总规则。
但是,如果您正在寻找在多个测试用例中重用脚本的方法,我强烈建议您使用Rollup规则。这是非常强大的,许多用户低估了Selenium IDE的特性。
使用Rollup规则的详细信息写在Selenium IDE的帮助页面上: menu help - UI-Element Documentation,然后通过关键字"Rollup“进行搜索。
发布于 2014-12-22 00:42:36
我最终按照Yevgen的建议使用了Rollups。我花了一些时间来找到实现这一点的正确方法。基本思想是,您最终编写了一个JavaScript文件,该文件将被添加到Selenium IDE的Selenium Core Extensions设置中的options/options下。您需要编写JavaScript文件来构建您的“可重用命令栈”,它将允许您使用内置的rollup命令,并将目标设置为您分配给一组命令的标签。
我写了一篇关于Selenium IDE Includes AKA Rollups的文章,这可能是一个有用的资源。
汇总脚本示例:
/**
* For use in Selenium IDE.
*
* You will need to add this to Selenium under Options / Options in the Selenium Menu.
* Put this under Selenium Core Extensions:
* ~/selenium-ide-for-slp/sideflow.js , ~/selenium-ide-for-slp/slp_rollups.js
*
*
*/
var manager = new RollupManager();
/**
* check_for_syntax_errors
*
* This rollup tests for php syntax errors, warnings, and notices.
*/
manager.addRollupRule({
name: 'check_for_syntax_errors',
description: 'Check for PHP syntax errors, notices, warnings.',
args: [],
commandMatchers: [],
getExpandedCommands: function(args) {
var commands = [];
commands.push({
command: 'assertNotText',
target: '//body',
value: '*Notice: Undefined*'
});
commands.push({
command: 'assertNotText',
target: '//body',
value: '**Notice: Trying to get*'
});
commands.push({
command: 'assertNotText',
target: '//body',
value: '*Notice: Use of*'
});
commands.push({
command: 'assertNotText',
target: '//body',
value: '*Fatal error:*'
});
return commands;
}
});希望这能有所帮助。
https://stackoverflow.com/questions/18492031
复制相似问题