目录
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
- alert text: text to check
assert checked
Confirm that the target element has been checked. The test will stop if the assert fails.
arguments
- locator: An element locator.
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
- locator: An element locator.
assert element present
Confirm that the target element is present somewhere on the page. The test will stop if the assert fails.
arguments
- locator: An element locator.
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
- locator: An element locator.
assert not checked
Confirm that the target element has not been checked. The test will stop if the assert fails.
arguments
- locator: An element locator.
assert not editable
Confirm that the target element is not editable. The test will stop if the assert fails.
arguments
- locator: An element locator.
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
-
select locator: An element locator identifying a drop-down menu.
-
text: An exact string match. Support for pattern matching is in the works. See https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.
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
-
locator: An element locator.
-
text: An exact string match. Support for pattern matching is in the works. See https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.
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
-
select locator: An element locator identifying a drop-down menu.
-
text: An exact string match. Support for pattern matching is in the works. See https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.
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
-
select locator: An element locator identifying a drop-down menu.
-
text: An exact string match. Support for pattern matching is in the works. See https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.
assert text
Confirm that the text of an element contains the provided value. The test will stop if the assert fails.
arguments
-
locator: An element locator.
-
text: An exact string match. Support for pattern matching is in the works. See https://github.com/SeleniumHQ/selenium-ide/issues/141 for details.