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.

_assertTrue(_isVisible("Some Text")) is failing even though the same text is present on the page

sgupta2sgupta2 Members
edited January 2014 in Sahi Pro
I am using the following statement _assertTrue(_isVisible("XYZ")) , to assert the presence of XYZ on a page. Even though XYZ is present on the page, the assertion is failing.

Please suggest what could have been going wrong?

Answers

  • Hi sgupta,
    Your assert statement should include the proper accessor of the element "XYZ".
    eg, if its a div, it should be like:
    _assertTrue(_isVisible(_div("XYZ")));
    
    or a button would be like:
    _assertTrue(_isVisible(_button("XYZ")));
    
    and so on..

    Hope this helps.

    Regards,
    Pratyush
  • For making - well not entirely - sure that some text is present *somewhere*, you could
    _assertTrue(document.body.textContent.match("SomeText"))
    or maybe
    _assertContainsText("Sometext", document.body)
    
Sign In or Register to comment.