Top Rounds
| We are Hiring! |

_assertContainsText ·

This is a Browser Action API.

_assertContainsText will assert that an element contains the given text
_assertContainsText will log failures to the playback logs if the condition evaluates to false.
DO NOT USE THIS IN AN IF CONDITION as it does not return any value, and throws an exception if the condition is false

Syntax:

_assertContainsText(expectedText, element, message)

The parameters are:

  • expectedText: Text expected to be present. This can be replaced with a regular expression.
  • element: html dom element on where the text is to be found
  • message: Message to be written to logs if text was not present

Example:

_assertContainsText("Invalid Login", _div("login_section"), "Text was not present"); _assertContainsText(/[Ii]nvalid/, _div("login_section"), "Text was not present"); _assertContainsText("Invalid Login", _div("login_section")); _assertContainsText(/[Ii]nvalid/, _div("login_section"));




---


Top Rounds