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.
Cannot find function _containsHTML, _containsText
Hi everyone.
In the new version of Sahi (v2) the SAHI controller is returning this error:
Error in script:
TypeError: Cannot find function _containsHTML. (<cmd>#2)
--Stopped Playback: FAILURE--
In the proxy appears the following message:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function _containsHTML. (<cmd>#2)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3232)
at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3244)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3304)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1988)
at org.mozilla.javascript.gen.c12._c0(<cmd>:2)
at org.mozilla.javascript.gen.c12.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at org.mozilla.javascript.gen.c12.call(<cmd>)
at org.mozilla.javascript.gen.c12.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1144)
at net.sf.sahi.rhino.ScriptRunner.run(ScriptRunner.java:52)
at java.lang.Thread.run(Unknown Source)
My .sah file is very simple:
_containsHTML(_byId("M_ctl04__x_y_0_lbl"), "some text");
However the following works fine:
_debug(_getText( _byId("M_ctl04__x_y_0_lbl")));
Because in the proxy appears the text that I want.
Can anyone help me?
In the new version of Sahi (v2) the SAHI controller is returning this error:
Error in script:
TypeError: Cannot find function _containsHTML. (<cmd>#2)
--Stopped Playback: FAILURE--
In the proxy appears the following message:
org.mozilla.javascript.EcmaError: TypeError: Cannot find function _containsHTML. (<cmd>#2)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3226)
at org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:3216)
at org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:3232)
at org.mozilla.javascript.ScriptRuntime.typeError1(ScriptRuntime.java:3244)
at org.mozilla.javascript.ScriptRuntime.notFunctionError(ScriptRuntime.java:3304)
at org.mozilla.javascript.ScriptRuntime.getPropFunctionAndThis(ScriptRuntime.java:1988)
at org.mozilla.javascript.gen.c12._c0(<cmd>:2)
at org.mozilla.javascript.gen.c12.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:337)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:2755)
at org.mozilla.javascript.gen.c12.call(<cmd>)
at org.mozilla.javascript.gen.c12.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1144)
at net.sf.sahi.rhino.ScriptRunner.run(ScriptRunner.java:52)
at java.lang.Thread.run(Unknown Source)
My .sah file is very simple:
_containsHTML(_byId("M_ctl04__x_y_0_lbl"), "some text");
However the following works fine:
_debug(_getText( _byId("M_ctl04__x_y_0_lbl")));
Because in the proxy appears the text that I want.
Can anyone help me?
Comments
This works!
_alert(_containsText(_cell(_table(2), 2, 3), "AA"));
This DOESN'T work:
if(condition(_containsText(_cell(_table(2), 2, 3), "AA")))
{
_alert("1");
}
else
{
_alert("2");
}
Why?
I think this might work, too, since _containsText returns TRUE or FALSE:
if(_containsText(_cell(_table(2), 2, 3), "AA"))
{
_alert("1");
}
else
{
_alert("2");
}