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.
How to retrieve data from excel
it is showing the --Stopped Playback: FAILURE--
Starting script
ERROR
missing ( before function parameters. at Feb 20, 2012 5:46:19 AM
Stopping script
I want to capture data from excel sheet and export in FIRE FOX
i am using windowsxp,Fire fox,Sahi V 3.5 open source
my code:----
function contact info($name,$emailid,$cellphone,$landline,$Plot/Apt/Door Number,$Street/Locality,$Landmark,$area)
{
_setValue(_textbox("name[1]"), $name);
_setValue(_textbox("email"), $emailid);
_setValue(_textbox("cellno"), $cellphone);
_setValue(_textbox("landline"), $landline);
_setValue(_textbox("address-first"), $Plot/Apt/Door Number);
_setValue(_textbox("address-second"), $Street/Locality);
_setValue(_textbox("address-landmark"), $Landmark);
_setValue(_textbox("address-area"), $area);
_click(_checkbox("asap"));
_setValue(_textbox("date"), "2012-03-24");
_click(_listItem("Bring me food as soon as possible"));
_click(_listItem("Bring me food as soon as possible"));
_click(_checkbox("asap"));
_setSelected(_select("hours"), "9");
_setSelected(_select("ampm"), "PM");
_setValue(_textarea("instructions"), "bring the food soon");
_click(_button("Send This Order"));
_click(_checkbox("1"));
_click(_button("Send"));
_click(_link("Close[1]"));
}
try
{
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}; DBQ=C:\Documents and Settings\jetech\Desktop\\sandhi.xlsx;readOnly=false", "", "");
$$arr1 = db.select("select * from [Sheet1$]");
for(var $i=0;$i<$arr1.length;$i++){
contact info($arr1[$i]["Name"], $arr1[$i]["emailid"], $arr1[$i]["CellPhone"], $arr1[$i]["landline"],$arr1[$i]["PlotNumber"], $arr1[$i]["Street"], $arr1[$i]["Landmark"], $arr1[$i]["area"]);
}
_wait(15000,_exists(element));
}
catch(e)
{
//_logException(e);
}
My excel sheet is also given below:
Name Emailid Cellphone Landline Plot/Apt/Door Number Street/Locality Landmark area
ram 123.gmail.com 8050485191 26583195 no.1627 jayanagar nr central jpnagar
Starting script
ERROR
missing ( before function parameters. at Feb 20, 2012 5:46:19 AM
Stopping script
I want to capture data from excel sheet and export in FIRE FOX
i am using windowsxp,Fire fox,Sahi V 3.5 open source
my code:----
function contact info($name,$emailid,$cellphone,$landline,$Plot/Apt/Door Number,$Street/Locality,$Landmark,$area)
{
_setValue(_textbox("name[1]"), $name);
_setValue(_textbox("email"), $emailid);
_setValue(_textbox("cellno"), $cellphone);
_setValue(_textbox("landline"), $landline);
_setValue(_textbox("address-first"), $Plot/Apt/Door Number);
_setValue(_textbox("address-second"), $Street/Locality);
_setValue(_textbox("address-landmark"), $Landmark);
_setValue(_textbox("address-area"), $area);
_click(_checkbox("asap"));
_setValue(_textbox("date"), "2012-03-24");
_click(_listItem("Bring me food as soon as possible"));
_click(_listItem("Bring me food as soon as possible"));
_click(_checkbox("asap"));
_setSelected(_select("hours"), "9");
_setSelected(_select("ampm"), "PM");
_setValue(_textarea("instructions"), "bring the food soon");
_click(_button("Send This Order"));
_click(_checkbox("1"));
_click(_button("Send"));
_click(_link("Close[1]"));
}
try
{
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)}; DBQ=C:\Documents and Settings\jetech\Desktop\\sandhi.xlsx;readOnly=false", "", "");
$$arr1 = db.select("select * from [Sheet1$]");
for(var $i=0;$i<$arr1.length;$i++){
contact info($arr1[$i]["Name"], $arr1[$i]["emailid"], $arr1[$i]["CellPhone"], $arr1[$i]["landline"],$arr1[$i]["PlotNumber"], $arr1[$i]["Street"], $arr1[$i]["Landmark"], $arr1[$i]["area"]);
}
_wait(15000,_exists(element));
}
catch(e)
{
//_logException(e);
}
My excel sheet is also given below:
Name Emailid Cellphone Landline Plot/Apt/Door Number Street/Locality Landmark area
ram 123.gmail.com 8050485191 26583195 no.1627 jayanagar nr central jpnagar
Comments
Please try to change the Function name as contact_info and then try again...
ERROR
syntax error at Feb 20, 2012 6:42:54 AM
it is showing error in catch(e)
Your {} braces are also messed up
i am using windowsxp,Fire fox,Sahi V 3.5 open source
excel:--
name emailid cellphone Landline Plot/Apt/Door Number Street/Locality Landmark area
ram 123.gmail.com 8050485191 26583195 no.1627 rama street central jpnagar
coding part:--
function contact_info ($name, $emailid, $cellphone, $landline, $Plot_Apt_Door_Number, $Street_Locality, $Landmark, $area)
{
_click(_link("MENU"));
_click(_link("+"));
_click(_link("+[1]"));
_click(_link("+[2]"));
_click(_link("+[3]"));
_click(_link("+[4]"));
_click(_link("+[5]"));
_click(_link("ORDER THIS"));
_setValue(_textbox("name[1]"), $name);
_setValue(_textbox("email"), $emailid);
_setValue(_textbox("cellno"), $cellphone);
_setValue(_textbox("landline"), $landline);
_setValue(_textbox("address-first"), $Plot_Apt_Door Number);
_setValue(_textbox("address-second"), $Street_Locality);
_setValue(_textbox("address-landmark"), $Landmark);
_setValue(_textbox("address-area"), $area);
_click(_checkbox("asap"));
_setValue(_textbox("date"), "2012-03-24");
_click(_listItem("Bring me food as soon as possible"));
_click(_listItem("Bring me food as soon as possible"));
_click(_checkbox("asap"));
_setSelected(_select("hours"), "9");
_setSelected(_select("ampm"), "PM");
_setValue(_textarea("instructions"), "bring the food soon");
_click(_button("Send This Order"));
_click(_checkbox("1"));
_click(_button("Send"));
_click(_link("Close[1]"));
}
try {
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver",
"jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Documents and Settings\\jetech\\Desktop\\sandhi.xls;readOnly=false", "", "");
$arr1 = db.select("select * from [Sheet1$]");
alert($arr1.length);
for(var $i=0; $i<$arr1.length; $i++){
contact_info($arr1[$i]["name"], $arr1[$i]["emailid"], $arr1[$i]["CellPhone"], $arr1[$i]["landline"],$arr1[$i]["Plot/Apt/Door Number"], $arr1[$i]["Street/Locality"], $arr1[$i]["Landmark"], $arr1[$i]["area"]);
}
_wait(15000,_exists(element));
} catch(e) {
_logException(e);
}
error part:
Script error. (:)
--Stopped Playback: SUCCESS--
starting script
Logging exception:
exception: java.sql.SQLException: [Microsoft][ODBC Excel Driver] The Microsoft Office Access database engine could not find the object 'Sheet1$'. 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:247)
at org.mozilla.javascript.Interpreter.interpretLoop(Interpreter.java:3330)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:2487)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:164)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:398)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3065)
at org.mozilla.javascript.InterpretedFunction.exec(InterpretedFunction.java:175)
at org.mozilla.javascript.Context.evaluateString(Context.java:1104)
at net.sf.sahi.rhino.RhinoScriptRunner.run(RhinoScriptRunner.java:114)
at java.lang.Thread.run(Unknown Source) at Feb 20,
Also check that C:\\Documents and Settings\\jetech\\Desktop\\sandhi.xls is the right file path, and that you have read access to it. (Might need to open sahi as administrator on windows)