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.
How to set partial assertion.
Hi All,
I am using "Build: 2009-02-10". I am getting a Successful Completion message after submitting a form.
I am able to assert that message successfully by using following syntax:
_assertExists(_spandiv("---message---"));
_assertContainsText("---message---", _spandiv("---message---"));
But I failed when it comes for partial assertion. Sahi is taking complete message as a string.
Ex. message displays as " Successfully submitted form#123"
I want to put check only on "Successfully submitted" because the numeric value is dynamic it changes in each iteration.
Any buddy plz help me out.
I am using "Build: 2009-02-10". I am getting a Successful Completion message after submitting a form.
I am able to assert that message successfully by using following syntax:
_assertExists(_spandiv("---message---"));
_assertContainsText("---message---", _spandiv("---message---"));
But I failed when it comes for partial assertion. Sahi is taking complete message as a string.
Ex. message displays as " Successfully submitted form#123"
I want to put check only on "Successfully submitted" because the numeric value is dynamic it changes in each iteration.
Any buddy plz help me out.
Comments
Use regular expression like:
_assertContainsText(/Successfully submitted/, _spandiv("SpandivName"));
Regards,
Pankaj.
_assertContainsText(/button (floatright|floatleft) disabled/, _byId("widget.activitiesList_viewbutton").className);
OR
_assertEqual(_byId("widget.activitiesList_viewbutton").className, /button (floatright|floatleft) disabled/);
_assertExists(_spandiv(/button (floatright|floatleft) disabled/));
The signature of _assertContainsText is _assertContainsText(expectedText, element, failureMessage). Here the element is a DOM element from the page.
What you want to check is that the className matches a regex.
You should do: Regards,
Narayan
But will it work if i specify the failure message with _assertContainsText??? OR is there way to use it with _assertTrue?