Skip to main content

Assert

Assert Contains Text

As the name suggests, assert contains text checks for a string in the target element and logs success or failure.

It will log the step details if the assertion passes else it logs as a failure if the expected string or reg-ex is not part of the text content of a given element with a proper explanation and stops the script playback.

Note: Do not use this in an if condition as it does not return any value, and throws an exception if the assertion fails.

The example below and Usage: 

cdn?allowAnimated=true&client=62fa6f95-a409-4c70-ba8d-46b7a5da5b2d&collection=contentId-3019080297&height=125&max-age=2592000&mode=full-fit&source=mediaCard&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiI2MmZhNmY5NS1hNDA5LTRjNzAtYmE4ZC00NmI3YTVkYTViMmQiLCJhY2Nlc3MiOnsidXJuOmZpbGVzdG9yZTpjb2xsZWN0aW9uOmNvbnRlbnRJZC0zMDE5MDgwMjk3IjpbInJlYWQiXX0sImV4cCI6MTc4NjM3NjE1OSwibmJmIjoxNzg2MzczMjc5LCJhYUlkIjoiNzEyMDIwOmM2ZTVmMGY1LWM5MDktNGJmYy1iNzBkLTRhNGRiM2IxNTc0NSIsImh0dHBzOi8vaWQuYXRsYXNzaWFuLmNvbS9hcHBBY2NyZWRpdGVkIjpmYWxzZSwiYXV0aFR5cGUiOiJzZXNzaW9uIn0.BFW6Y-nv1YZQHlY8c921ru4FczXLGNO8sCmHcPnGbw0&width=442#media-blob-url=true&id=f9bc66e9-ea24-46f1-99a8-0bba0e1633f0&clientId=62fa6f95-a409-4c70-ba8d-46b7a5da5b2d&contextId=contentId-3019080297&collection=contentId-3019080297

The accessor column shows the HTML DOM Element of the web page.

The value column shows the Expected String, Regular expressions can also be used.