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.
Syntax Error Generated
Code is as follows:
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\\values\\test40v.xls;readOnly=false","","",
"");
$rs = db.select("select * from [Sheet1$]");
login($rs[0]["usrid"], $rs[0]["paswrd"], $rs[0]["cmpnyid"]);
var $data = _readCSVFile("C:\sahi\userdata\scripts\values\test40values.csv");
for (var $i=0; $i<$data.length; $i++){
var $row = $data[$i];
userAuthentication($row[0], $row[1], $row[2]);
}
excel sheet: test40v.xls
CSV file in excel: test40values.csv
function: userAuthentication
Error displayed in "View Logs":
JSERROR
SyntaxError: syntax error at Jul 13, 2010 5:17:39 PM
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\\values\\test40v.xls;readOnly=false","","",
"");
$rs = db.select("select * from [Sheet1$]");
login($rs[0]["usrid"], $rs[0]["paswrd"], $rs[0]["cmpnyid"]);
var $data = _readCSVFile("C:\sahi\userdata\scripts\values\test40values.csv");
for (var $i=0; $i<$data.length; $i++){
var $row = $data[$i];
userAuthentication($row[0], $row[1], $row[2]);
}
excel sheet: test40v.xls
CSV file in excel: test40values.csv
function: userAuthentication
Error displayed in "View Logs":
JSERROR
SyntaxError: syntax error at Jul 13, 2010 5:17:39 PM
Comments
Mozilla Firefox v-3.6.6
Windows 2000 SP 4
Anmol
var $data = _readCSVFile("C:\sahi\userdata\scripts\values\test40values.csv");
to
var $data = _readCSVFile("C:\\sahi\\userdata\\scripts\\values\\test40values.csv");
Kindly help me out.
now the error is:
on log-
JSERROR
SyntaxError: missing ] after element list at Jul 22, 2010 5:04:02 PM
on conolse:
java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database
engine could not find the object 'Sheet1$'. Make sure the object exists and th
at you spell its name and the path name correctly.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:101)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:24
7)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c1._c56(<cmd>:462)
at org.mozilla.javascript.gen.c1.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c2._c0(<cmd>:25)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:3
98)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:306
5)
at org.mozilla.javascript.gen.c2.call(<cmd>)
at org.mozilla.javascript.gen.c2.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:93)
at java.lang.Thread.run(Unknown Source)
IE6
Please have a look at this thread: http://sahi.co.in/forums/viewtopic.php?id=1635
Regards,
Narayan
The code is:
=====code starts here.
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\\userdata\\values\\test40v.xls;readOnly=false","","");
var $rs = [];
$rs[0] = [];
$rs = db.select("select * from [Data$]");
for (var $i=0; $i<$rs.length; $i++)
{
_setSelected(_select("SelectuserAuthentication"), $rs[$i]["Login"]);
}
===code ends here.
Excel sheet:test40v.xls
Worksheet:Data
Column header:Login
Entries are:
Login
userid entry1 entry2 entry3 entry4 entry5
password entry6 entry7 entry8 entry9 entry10
company entry11 entry12 enrty13 entry14 entry15
with the help of these entries i want to pass the values of 3 parameters of the function userAuthentication($userid,$password,$company);
ERROR DISPLAYS:
on log-
JSERROR
SyntaxError: missing ] after element list at Jul 23, 2010 12:39:14 PM
on console-
java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Jet database
engine could not find the object 'Data$'. Make sure the object exists and that
you spell its name and the path name correctly.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(Unknown Source)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:101)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:79)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:161)
at org.mozilla.javascript.NativeJavaMethod.call(NativeJavaMethod.java:24
7)
at org.mozilla.javascript.optimizer.OptRuntime.callN(OptRuntime.java:86)
at org.mozilla.javascript.gen.c9._c56(<cmd>:462)
at org.mozilla.javascript.gen.c9.call(<cmd>)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.mozilla.javascript.gen.c10._c0(<cmd>:27)
at org.mozilla.javascript.gen.c10.call(<cmd>)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:3
98)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:306
5)
at org.mozilla.javascript.gen.c10.call(<cmd>)
at org.mozilla.javascript.gen.c10.exec(<cmd>)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:93)
at java.lang.Thread.run(Unknown Source)
Now i am stuck up in the step of passing values to the parameters of the function.
Suppose i have a function with 3 log in details i.e. 3 parameters are reqired to be passed to the function.
Now i am not able to retrieve the values properly from the excel sheet.
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=C:\\sahi\\userdata\\values\\test40v.xls;readOnly=false","","");
var $rs = [];
$rs[0] = [];
$rs = db.select("select * from [Data$]");
for (var $i=0; $i<$rs.length; $i++)
{
_setSelected(_select("userAuthentication"), $rs[$i]["userid"],$rs[$i]["password"],$rs[$i]["company"]);
}
Error on log-
_setSelected(_select("userAuthentication"), "entry1","entry2","entry3");
TypeError: 'options' is null or not an object
No trace available
No error display on console.
Excel sheet:test40v.xls
Worksheet:Data
Column header:userid,password,company
Entries are:
userid password company
entry1 entry2 entry3
entry4 entry5 entry6
entry7 entry8 entry9
Regards
Anmol
Why are you using
_setSelected(_select("userAuthentication"), $rs[$i]["userid"],$rs[$i]["password"],$rs[$i]["company"]);
?
It is incorrect. See http://sahi.co.in/w/_setSelected
Regards,
Narayan
_setSelected(_select("userAuthentication"), $rs[$i]["userid"]);
& i was facing the same error:
Error on log-
_setSelected(_select("userAuthentication"), "entry1");
TypeError: 'options' is null or not an object
No trace available
No error display on console.
Regards
Anmol