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.

Error with Excel Sheet configuration

hemohinihemohini Members
edited November -1 in Sahi - Open Source
I'm using Excel sheet configuration for the first time, we are trying to automate web application.

I'm using the below code in order to get the data from the excel..the excel sheet is having one columns in the sheet1.
The columns name being GroupName and Description...Under GroupName and Description.....i've given the corresponding values...

I'm getting the following error when I try to run the below mentioned code:

Error Message:- JSERROR SyntaxError: syntax error(This error is shown in the log file)

I'm using MS office 2000.

Please see the below mentioned code given below that I've used as part of the script...

for ($i=0; $i<$len; $i++)
{
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\\Sahi_New\\scripts\\test.xls;readOnly=false", "", "");
var $rs = db.select("select * from [Sheet1$]");
var $GroupName =($rs[$i]["GroupName"]); //name of the column
var $Description =($rs[$i]["Description"]); //name of the column
_wait(3000);
//***Group Name Verification***
if ($GroupName == "GroupName")
{
_popup("Admin")._setValue(_textbox("groupNm"), $GroupName);
}
//***Description Field Verification***
if ($returnValue == "description")
{
_popup("Admin")._setValue(_textarea("description"), $Description);
}
_wait(2000);
_popup("Admin")._click(_submit(" Save "));
_wait(3000);
} //End of function

Is there any settings that I need to do before using the above mentioned..

Please help.. ASAP, if possible.

Regards,
Shambala

Comments

  • dpdp Members
    Please copy and paste the below code in a new .sah file, execute it and let me know what you get

    var $db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver","jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=D:\\Sahi_New\\scripts\\test.xls;readOnly=false","","");
    
    $rs = db.select("select * from [Sheet1$]");
    var $GroupName = $rs[0]["GroupName"];
    var $Description  = $rs[0]["Description"];
    
    _debug($GroupName + " " + $Description);
    
    


    Cheers
    dp
  • Thank you for your reply.

    Code is working properly now and excel sheet values get passed in the fields properly.
Sign In or Register to comment.