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.
Variable assignments/storing
Hi. I had looked through Sahi forum and tried a few suggestions but can not get my script to work. When I run the script below I get an error: _sahi.setServerVar('\$objId', getObjValById("SelectSorting_Chart_1", "src"));
TypeError: Object expected
I have created a function to obtain specified object property by inputting the object id
function getObjValById($id, $prop){
eval("var $val = document.getElementById($id)." + $prop);
return $val;
}
// Here I am assigning the value returned from the function to the var $objId
var $objId;
_set($objId,getObjValById("SelectSorting_Chart_1", "src"));
// if var $objID equals to the value indicated then click on the image, else alert "OOPS!"
if ($objId == "*H_Charting/sortA.gif"){
_click(_image("SelectSorting_Chart_1"));
}
else{
_alert ("OOPS!")
}
TypeError: Object expected
I have created a function to obtain specified object property by inputting the object id
function getObjValById($id, $prop){
eval("var $val = document.getElementById($id)." + $prop);
return $val;
}
// Here I am assigning the value returned from the function to the var $objId
var $objId;
_set($objId,getObjValById("SelectSorting_Chart_1", "src"));
// if var $objID equals to the value indicated then click on the image, else alert "OOPS!"
if ($objId == "*H_Charting/sortA.gif"){
_click(_image("SelectSorting_Chart_1"));
}
else{
_alert ("OOPS!")
}
This discussion has been closed.
Comments
Use: