vendredi 20 février 2015

Comparing variable to textbox value with javascript and Sahi


I am writing a test script using sahi, which uses JavaScript. The problem i am having is comparing a textbox value with a variable that is set. This a sync test and the variable that is set is the same textbox but on another page. I am using the localeCompare() and it is returning a value of 1 when it should be 0. Thank You, I appreciate any help.


The code is below:



_click(_submit("Origin"));

/* Origin Address */

_set( $oAddress1, _textbox("ctl00$ContentPlaceHolder1$FormView1$Address1").value);
_log( $oAddress1);

_click(_submit("Shipment"));
_click(_link($oa));
_click(_submit("Origin"));


/*Origin Agent Address*/
$compare = $oAddress1.localeCompare(_textbox("ctl00$ContentPlaceHolder1$FormView1$Address1").value);
_alert($compare);
_pause();

if ($compare == 0) {
_log("Success");
} else {
$mdAddress1 = "Master Agent and OA Origin Address 1 do not match";
}

if ( typeof $mdAddress1 === 'undefined' ) {
_log("Success");

} else {

sendEmail("Star Sync Error", " Script: " + $mdAddress1 );

}




Aucun commentaire:

Enregistrer un commentaire