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.

How to pass the value of _lastAlert() in the HTML

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

In my application, i have to validate the PopUps so, for that i have written code as follows:

var $actualValue =_lastAlert();

var $expectedValue = "User LoginID is Required";

var $htmlReport = "<html><body><table border='1' colspan='2'><th>Check Point</th><th>Actual Value</th><th>Expected Value</th><th>Status</th>";

if(_condition(_lastAlert() == $expectedValue)){
$htmlReport += "<tr><td>PopUp</td><td>"+$actualValue+"</td><td>"+$expectedValue+"</td><td><b><font color='green'>"+"Pass"+"</font></b></td></tr>";
}

-> In the html page, it's shown as "_sahi._lastAlert()" insteadof "User LoginID is Required".



Thanks in Advance.

Thanks & Regards,
Tulasi
Tagged:

Comments

  • narayannarayan Administrators
    Hi Tulasi,

    Use
    _set($actualValue, _lastAlert());

    instead of
    var $actualValue =_lastAlert();

    Regards,
    Narayan
  • Thanks Narayan.
This discussion has been closed.