18 January 2026:


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.

JSERROR TypeError: Cannot find function _containsHTML.

keatskeats Members
edited November -1 in Sahi - Open Source
Hi,

This JSerror is shown for following lines of script.
Script :
============
Option 1:
if(_containsHTML(_byId("tblConfirm")))
{
_debug("iam at If 1");
_assertEqual("Record successfully created", _getText(_cell(_table("tblConfirm"), 1, 0)));
}
Here i get "JSERROR TypeError: Cannot find function _containsHTML."

I am using Sahi V2 Release 2009-03-04.

Earlier i was using the following code but here also it failed thats why i went for option1.
Scenario: there are two table ids which does not appear at the same time. tblConfirm will appear only if the scenario is successfully saved, tblError is shown when there is error in saving record.

Option 2:
1. _set($str,_containsHTML(_byId("tblConfirm")));
2. _set($str1,_containsHTML(_byId("tblError")));
3. if(_condition($str != null))
4. {
5. <<Do something>>
6.
7. }
8. else if(_condition($str1))
9. {
10. _debug("iam at else if 1");
11. }

- Here when it does not find table id "tblConfirm" , Line 1 is set to null.
So in line3 it matches null!=null. This fails. meaning it goes inside this if function. Here also i am not sure what's wrong and why does it go inside the if statment.
Both the option is finally not working.

Any help please??

Comments

  • dpdp Members
    The below code should work for you

    if(_condition(_byId("tblConfirm")!=null))
    {
    _debug("Successfully saved");
    }
    else
    {
    _debug("Error!!");
    }
  • keatskeats Members
    Now it says JSERROR TypeError: Cannot find function _byId.

    Whats is the best solution for this?
    Why is the latest version of sahi not recognizing the api's?
  • dpdp Members
    keats,

    Me too use Sahi V2 Release 2009-03-04 and I do not have any issue in using these APIs
Sign In or Register to comment.