Please note that Sahi's development and support teams do not actively monitor this. This is more a community forum. If you are a Sahi Pro user looking for commercial support, please email support @ sahipro.com with your query.

_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.