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.
Unable to execute data driven test with excel sheet
I'm trying to login to a website with using data driven test using excel sheet.
I've saved an excel sheet in C:\sahi\userdata\login.xls
It has the data in "Sheet1" as follows
uname pwd
user1 password1
user2 password2
uname and pwd are the column titles.
I'm using the following code in the script file.
function login($uname, $pwd)
{
_setValue(_textbox("uname"), $uname);
_setValue(_password("passwd"), $pwd);
_click(_image("submit.png"));
}
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\userdata\login.xls;readOnly=false", "", "");
$rs = db.select("select * from [Sheet1$]");
login($rs[0]["uname"], $rs[0]["pwd"]);
When i'm running the script i'm getting --Stopped Playback: FAILURE--
It shows the following when i check the log.
Test Total Steps Failures Errors Success Rate
Test_dataDriven_Excel.sah 1 0 1 0%
Starting script
JSERROR
SyntaxError: missing ] after element list at Jun 3, 2010 5:35:24 PM
Stopping script
I didn't find any missing ] in the code. Please help me with executing the script successfully.
I've saved an excel sheet in C:\sahi\userdata\login.xls
It has the data in "Sheet1" as follows
uname pwd
user1 password1
user2 password2
uname and pwd are the column titles.
I'm using the following code in the script file.
function login($uname, $pwd)
{
_setValue(_textbox("uname"), $uname);
_setValue(_password("passwd"), $pwd);
_click(_image("submit.png"));
}
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\userdata\login.xls;readOnly=false", "", "");
$rs = db.select("select * from [Sheet1$]");
login($rs[0]["uname"], $rs[0]["pwd"]);
When i'm running the script i'm getting --Stopped Playback: FAILURE--
It shows the following when i check the log.
Test Total Steps Failures Errors Success Rate
Test_dataDriven_Excel.sah 1 0 1 0%
Starting script
JSERROR
SyntaxError: missing ] after element list at Jun 3, 2010 5:35:24 PM
Stopping script
I didn't find any missing ] in the code. Please help me with executing the script successfully.
This discussion has been closed.
Comments
All backslashes should be escaped.
C:\\sahi\userdata\login.xls
should be
C:\\sahi\\userdata\\login.xls
Regards,
Narayan