原文:http://blog.chinaunix.net/uid-8481040-id-2996277.html
介绍:http://iytc.net/wordpress/?p=2082
Selenium IDE的脚本语言比较简单,没有过程控制结构,所以没有办法做重复测试。
为了在IDE中增加过程控制功能,在Firefox里面可以安装一个叫做Flow control的控件
(
https://addons.mozilla.org/en-US/firefox/addon/flow-control/)。
安装之后,可以在IDE中使用while ... endWhile结构。
例子:
- store 1000 total
- store 0 count
- while storedVars['count'] < storedVars['total']
- getEval storedVars['count'] += 1
- ....
- ....
- ....
- endWhile
在例子中,循环体里面的语句将会执行1000次。
注意While 里面的判断是javascript格式,通过storedVars数组可以访问到selenium里面的存储变量。