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.
Passing object name from Excel sheet
Hi,
I am building framework for my application, In my framework i am Passing object name from Excel sheet.
eg: _select("ctl00\$cphMasterPlaceHolder\$ddlStatusCodes") value stored in Excel.
I am storing this value in my variable using recordset i.e
$strObjectName = $rs[$intSteps]["OBJECT_NAME"]; i m getting correct value in $strObjectName" variable.
but when i use this value in _setSelected statement
_setSelected($strObjectName,"6 - CM_Approved");
this statement adding "\" before double quotes(") and dollar($). and value is in double quotes i.e
_setSelected("_select(\"ctl00\\$cphMasterPlaceHolder\\$ddlStatusCodes\")","6 - CM_Approved");
It should be like:
_setSelected(_select("ctl00\$cphMasterPlaceHolder\$ddlStatusCodes"),"6 - CM_Approved");
Kindly reply me as early as possible.
I am building framework for my application, In my framework i am Passing object name from Excel sheet.
eg: _select("ctl00\$cphMasterPlaceHolder\$ddlStatusCodes") value stored in Excel.
I am storing this value in my variable using recordset i.e
$strObjectName = $rs[$intSteps]["OBJECT_NAME"]; i m getting correct value in $strObjectName" variable.
but when i use this value in _setSelected statement
_setSelected($strObjectName,"6 - CM_Approved");
this statement adding "\" before double quotes(") and dollar($). and value is in double quotes i.e
_setSelected("_select(\"ctl00\\$cphMasterPlaceHolder\\$ddlStatusCodes\")","6 - CM_Approved");
It should be like:
_setSelected(_select("ctl00\$cphMasterPlaceHolder\$ddlStatusCodes"),"6 - CM_Approved");
Kindly reply me as early as possible.
Comments
Did you solve this problem? I have the same question with you.
Narayan,
Do you have any suggestion to it? Thanks a lot.
Could you please post your query with full details as a separate post?
Regards,
Narayan
I try many many way, but no success.
I test it on google(google.com) and store the object in excel: _textbox("q").
My script is:
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=D:\\Book1.xlsx;readOnly=false", "","");
$rs=db.select("select * from [Sheet1$]");
var $con=$rs[0]["control"];
_setValue($con,"aa");
When it runs on sahi controller, the log shows:
_setValue("_textbox(\"q\")","aa"); this statement adding addition " and \ character, which cause the script run failed.
The correct should be _setValue(_textbox("q"),"aa");
I also use the following two ways, but they are failed too.
1._setValue(eval($rs[0]["control"]),"aa");
the log is: TypeError: Object expected
2.
var $con=eval($rs[0]["control"]);
_setValue($con,"aa");
the log is: ReferenceError: "_textbox" is not defined.
3.var $con=$rs[0]["control"];
_setValue(eval($con),"aa");
the log is: TypeError: Object expected
please help me out with this problem. Thanks a lot.
<browser>
function getObject($p_sValue,$p_sType){
switch($p_sType){
case "heading1":
var $obj = _heading1($p_sValue);
_alert(_exists($obj));
break;
}
return $obj;
}
</browser>
_alert(_exists(getObject($<value from excel>, $<property from excel>)));