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.
Date Assertion is failing
I am using the following function to enter date field in my form and when I am trying to assert it, it's failing.
function GetDate(){
var $wdate =_getValue(_textbox("date-picker-date"));
var $i = $wdate.indexOf(" ");
var $h = _getText(_textbox(6));
if ($h[0] == "0") {
$h = $h[1]}
if ($wdate.substring($wdate[$i] == "0")) {
$i = $wdate.indexOf("0")+1}
$wdate = $wdate.substring(0,3 ) + " " + $wdate.substring($i) + " " + $h + ":" + _getText(_textbox(7)) + " " + _getText(_button(47)).toLowerCase();
return $wdate;
}
var $wdate = GetDate();
As per my function, $wdate should display today's date, but when I insert _alert($wdate) it's not logging the expected date. The same code is working in few other scripts and it is failing in some. The scripts which are failing now have passed successfully earlier. Anybody can help me on this one, please.
function GetDate(){
var $wdate =_getValue(_textbox("date-picker-date"));
var $i = $wdate.indexOf(" ");
var $h = _getText(_textbox(6));
if ($h[0] == "0") {
$h = $h[1]}
if ($wdate.substring($wdate[$i] == "0")) {
$i = $wdate.indexOf("0")+1}
$wdate = $wdate.substring(0,3 ) + " " + $wdate.substring($i) + " " + $h + ":" + _getText(_textbox(7)) + " " + _getText(_button(47)).toLowerCase();
return $wdate;
}
var $wdate = GetDate();
As per my function, $wdate should display today's date, but when I insert _alert($wdate) it's not logging the expected date. The same code is working in few other scripts and it is failing in some. The scripts which are failing now have passed successfully earlier. Anybody can help me on this one, please.