Selenium学习(六) selenium IDE命令之 assert系列详解

目录

assert系列简介

相关方法

官方API

验证过程

小结


assert系列简介

使用断言,测试用例将会在断言失败后停止运行
优点:可以直接直接了当的看到检查是否通过
缺点:若检查失败,后续的检查不会被执行,无法收集检查的结果状态
 

相关方法

assert
assert alert
assert checked
assert confirmation
assert editable
assert element present
assert element not present
assert not checked
assert not editable
assert not selected value
assert not text
assert prompt
assert selected value
assert selected label
assert text
assert title
assert value

 

官方API


assert

Check that a variable is an expected value. The variable's value will be converted to a string for comparison. The test will stop if the assert fails.

arguments

  • variable name: The name of a variable without brackets.

  • expected value: The result you expect a variable to contain (e.g., true, false, or some other value).


assert alert

Confirm that an alert has been rendered with the provided text. The test will stop if the assert fails.

arguments


assert checked

Confirm that the target element has been checked. The test will stop if the assert fails.

arguments


assert confirmation

Confirm that a confirmation has been rendered. The test will stop if the assert fails.

arguments

  • text: The text to use.

assert editable

Confirm that the target element is editable. The test will stop if the assert fails.

arguments


assert element present

Confirm that the target element is present somewhere on the page. The test will stop if the assert fails.

arguments


assert element not present

Confirm that the target element is not present anywhere on the page. The test will stop if the assert fails.

arguments


assert not checked

Confirm that the target element has not been checked. The test will stop if the assert fails.

arguments


assert not editable

Confirm that the target element is not editable. The test will stop if the assert fails.

arguments


assert not selected value

Confirm that the value attribute of the selected option in a dropdown element does not contain the provided value. The test will stop if the assert fails.

arguments


assert not text

Confirm that the text of an element does not contain the provided value. The test will stop if the assert fails.

arguments


assert prompt

Confirm that a JavaScript prompt has been rendered. The test will stop if the assert fails.

arguments

  • text: The text to use.

assert selected value

Confirm that the value attribute of the selected option in a dropdown element contains the provided value. The test will stop if the assert fails.

arguments


assert selected label

Confirm that the label of the selected option in a dropdown element contains the provided value. The test will stop if the assert fails.

arguments


assert text

Confirm that the text of an element contains the provided value. The test will stop if the assert fails.

arguments


</

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值