原文: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里面的存儲變量。