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.

Search for text ANYWHERE on webpage

TSheeleyTSheeley Members
edited November -1 in Sahi - Open Source
Is there a way to verify the existence, or non-existence of a string ANYWHERE on a page?? We sometime get PHP errors and they can appear quite literally anywhere on the page. I would like to check for there existence and do some error trapping - even though I can't get the try/catch method to work for _assert. Can anyone help???

Comments

  • You coudl try _assertContainsText("Text", document.body.textContent)

    Regards
    Wormi
  • Will try this now....
  • Hey Wormi!! You seem to trying to answer all my questions - thanks!!! Unfortunately, this doesn't work. It fails with: _assertContainsText("A PHP Error was encountered Severity: Notice Message:", document.body.textContent);
    TypeError: orig is undefined
  • Ahh me stupid... I had this Error earlier this day and was figuring... this won't happen a third time today! xD

    well _assertContainsText("A PHP Error was encountered Severity: Notice Message:", document.body);
    will work as you have to give an element as argument..
  • Far from stupid my friend. Thanks. This worked perfectly for what I need. T
This discussion has been closed.