Selenium学习(八) selenium IDE命令之 流程控制系列详解

本文详细介绍了Selenium IDE的流程控制命令,包括if、else、end、times、do、repeat if、while和foreach,以及它们的使用方法和注意事项。这些命令允许在自动化测试中添加条件逻辑和循环,以实现更复杂的测试场景。
摘要由CSDN通过智能技术生成

目录

流程控制系列简介

相关方法

官方API

验证过程

命令详解


流程控制系列简介

使您能够向测试中添加条件逻辑和循环。这使您能够仅在满足应用程序中的某些条件时执行命令(或一组命令),或根据预定义的条件重复执行命令。

 

相关方法

一共有以下几组:

  • if, else if, else, end
  • times, end
  • do, repeat if
  • while, end
  • forech

 

官方API

if

Create a conditional branch in your test. Terminate the branch with the end command.

arguments

  • conditional expression: JavaScript expression that returns a boolean result for use in control flow commands.

else

Part of an if block. Execute the commands in this branch when an if and/or else if condition are not met. Terminate the branch with the end command.


else if

Part of an if block. Execute the commands in this branch when an if condition has not been met. Terminate the branch with the end command.

arguments

  • conditional expression: JavaScript expression that returns a boolean result for use in control flow commands.

end

Terminates a control flow block for if, while, and times.


times

Create a loop that executes the proceeding commands n number of times.

arguments

  • times: The number of attempts a times control flow loop will execute the commands within its block.

  • loop limit: An optional argument that specifies the maximum number of times a looping control flow command can execute. This protects against infinite loops. The defaults value is set to 1000.


do

Create a loop that executes the proceeding commands at least once. Terminate the branch with the repeat if command.


repeat if

Terminate a 'do' control flow branch conditionally. If the result of the provided conditional expression is true, it starts the do loop over. Otherwise it ends the loop.

arguments

  • conditional expression: JavaScript expression that returns a boolean result for use in control flow commands.

while

Create a loop that executes the proceeding commands repeatedly for as long as the provided conditional expression is true.

arguments

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值