18 January 2026:
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.
Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.
use _containsHTML and _containsText
i write _containsHTML (or _containstext) to Checks for existence of html (or to Checks for existence of text), when me run this script, nothing happen into log. So, how do i know the text existence (i try it with text not right but nothing happen)
Comments
You will need to assert it.
Use
_assert(_containsHTML(el, text));
_assert(_containsText(el, text));
or in case of Text you can use
_assertContainsText(text, el, failureMessage);
_navigateTo("http://sahi.co.in/w/_containshtml"
_assertExists(_div("d1"));
_assertContainsText("Formatted Text", _div("d1"));
_containsHTML(_byId("d1"), "<i>Formatted</i>") //=true
_assert(_containsHTML(_byId("d1"), "<i>Formatted</i>"));
_containsHTML(_byId("d1"), "Text") //=true
_containsHTML(_byId("d1"), "<i>Formatted</i> Text") //=true
_containsHTML(_byId("d1"), "Formatted Text") //=false
_containsHTML(_byId("d1"), "Non existent") //=false
but playback is failure and view log display line:
_assert(_containsHTML(_byId("d1"), "Formatted")); Assertion Failed. at Sep 21, 2009 4:21:33 PM
do you tell my why? thanks
_assert(_containsHTML(_byId("d1"), "<i>Formatted</i> Text"))
=> Assertion failure
i use your example that run but i can't run.
please explain for me
thanks