Selenium IDE循环/判断/JS插件:Flow control

Selenium IDE循环/判断/JS插件:Flow control

安装Flow control插件后,Selenium IDE可以支持循环、判断及js语句,可以很方便的重复执行刷帖,只是不能实现太复杂的逻辑。Firefox中搜索安装Flow control插件实现循环执行https://addons.mozilla.org/en-US/firefox/addon/flow-control/

selenium IDE

selenium IDE中使用js生成随机数:

|store | javascript{parseInt(Math.random()*(36100-15100)+15100)} | x |
|echo | ${x} | |      //输出echo: 34381
|pause | ${x} | |

其中js语句:javascript{parseInt(Math.random()*(36100-15100)+15100)},parseInt()取整数,Math.random()*(m-n)+n在m和n之间取随机数。

 

Flow control支持的命令

//有/无条件跳转
label – target label.
gotolabel – unconditional jump.
gotoIf – conditional jump.

//循环
while/endWhile – cycle.

//集合和for循环
addCollection – instantiate a collection.
addToCollection – adds a value to the indicated collection (JSON objects are ok).
storeFor – retrieves the next available value from your collection and stuffs it into the indicated temporary variable. If there’s no value available it jumps to the endFor.
endFor – marks the end of the execution block.

 

6san.com

评论已关闭。