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.

Logging Results

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

Assert cannot be included in IF conditions.

Can any one please provide a code to test asserions using IF condition:
If assertion passes, then log pass message
If assertion fails, then log fail message.

Thanks,
Samsirsameer.

Comments

  • narayannarayan Administrators
    if (_condition(_textbox("xx").value == "done")){
      _log("Passed");
    } else {
      _log("Failed");
    }
    
    Assertions are for asserting that a condition is valid. They do not evaluate to true or false. They verify whether the parameter passed to them is true or false.
  • Thanks Narayan.

    But my doubt is
    I want to check whether the page title of my application is displayed and is correct or not.
    If the page title is correct, then log message "page title is verified and is correct"
    Else
    Log message "Page title is incorrect" (Actual: ' ' Expected: ' ')


    Thanks,
    Samsirsameer.
Sign In or Register to comment.