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.

I am not able to use Excel sheets for data driven testing

mohanmohan Members
edited November 2011 in Sahi - Open Source
i tried this below script . I am using office 2010 . the data is not fetching from excel sheet. its directly printing the variable. i installed access database engine for 64 bit windows.
is there is anything i need to configure in odbc data source administrator?

the script is running successfully , but i am not able get the from excel sheet. log is not showing any error related to DB.

configuration
window 7 machine.
microsoft office 2010 64 bit version
access database engine 64 bit


below is i have taken from the sahi forum and modified the steps .

function login($uname, $pwd)
{
_setValue(_textbox("txtUserName"), "$uname");
_setValue(_password("txtPassword"), "$pwd");
_setSelected(_select("lstProductDB"), "Do Not Use WI");
_highlight(_submit("Login"));
_click(_submit("Login"));
}
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Users\\Mohans\\sahi\\userdata\\scripts\\sample.xls;readOnly=false", "", "");
$rs = db.select("select * from [Sheet1$]");
login($rs[0]["uname"], $rs[0]["password"]);

Comments

  • After i removed the other file types other than xls .

    i got the following error.

    exception: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:96)
    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 Nov 23, 2011 8:06:59 PM
  • Hi Mohan,

    Check if the excel is installed in your machine?

    Also, have a look at the below urls:

    http://sahi.co.in/forums/viewtopic.php?id=1840

    http://sahi.co.in/forums/viewtopic.php?id=2451

    http://sahi.co.in/forums/viewtopic.php?id=3022

    Let me know if this solvess your issue.

    Regards
    Sumitra
  • mohanmohan Members
    edited November 2011
    Hi Sumitra,

    Thanks for the reply, i Tried all the possiblities . still i am not able to run the script.
    Scenarios tested


    I removed 64 bit java,and installed 32 bit, sahi didnt start..

    so i i nstalled JDK 64 bit as suggested in one of the post.same error. Data source name not found and no default driver specified


    Previously i had 32 bit jre and 64 bit .same error. Data source name not found and no default driver specified


    64 bit alone. not worked for me. Data source name not found and no default driver specified

    my system configurations

    windows 7 enterprise

    service pack 1

    64 bit microsoft office 2010

    before i had 32 bit office 2010 .i am not able to install 64 bit Msaccess engine. so i removed 32 bit MS office and installed 64 bit ms access.
  • finally worked for you??
  • Hi Sunny,

    Could you let me know where exactly you are facing issue working with excel sheet?

    Regards
    Sumitra
Sign In or Register to comment.