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.
want to access excel sheet for datadriven testing in firefox
Hi
I want to access the excel sheet for data driven testing in firefox .Please guide me how t o perform this testing.
Regards
Anushree
I want to access the excel sheet for data driven testing in firefox .Please guide me how t o perform this testing.
Regards
Anushree
Comments
Have a look at http://sahi.co.in/w/data-driven-testing
Please, please, do search on the website and forums before you post questions here.
Regards,
Narayan
I have already gone through this site but was not able to get the idea properly.I will try again.
Thanks& Regards
Anushree
There is same topic posted by anoop.philip. Have you gone through that post. I think, it will help you.
you din't mention , what kind of error you are getting. please mention it.Then we will be able to help you.
I have done datadriven testing using firefox. It works.
Regards
Shashi
I have done data driven testing for login section but not able to perform it properly,getting error message.Iam doing this on firefox.
_navigateTo("URL", true);
_click(_link("signup"));
function login($email, $pwd)
{
_setValue(_textbox("email"), $email);
_setValue(_password("passwd"), $pwd);
_click(_submit("Log in"));
}
var $i;
var $data=_readFile("/home/users/anushree/lg.xls");
for($i=0;$i<data.length;i++)
{
login($i[0]["email"], $i[0]["pwd"]);
_click(_link("logout"));
}
If i am using this below statement to access data from excel sheet iam getting error message on konsole.Please do help me.
var db=_getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=/home/users/anushree/lg.xls;readOnly=false", "", "");
$rs=db.select("select * from [lg$]");
login($rs[0]["email"], $rs[0]["pwd"]);
Error message on Konsole
Driver: sun.jdbc.odbc.JdbcOdbcDriver
JDBC URL: jdbc:odbc:Driver={Microsoft Excel Driver (*.xls)};DBQ=/home/users/anushree/lg.xls;readOnly=false
Username:
Password:
SQL: select * from [lg$]
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
at java.sql.DriverManager.getConnection(DriverManager.java:525)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at net.sf.sahi.plugin.DBClient.getResult(DBClient.java:96)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:79)
at net.sf.sahi.plugin.DBClient.select(DBClient.java:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.sahi.command.CommandExecuter.execute(CommandExecuter.java:52)
at net.sf.sahi.LocalRequestProcessor.getLocalResponse(LocalRequestProcessor.java:43)
at net.sf.sahi.ProxyProcessor.processLocally(ProxyProcessor.java:179)
at net.sf.sahi.ProxyProcessor.run(ProxyProcessor.java:86)
at java.lang.Thread.run(Thread.java:595)
Are you on Linux? If yes, I don't think Microsoft Excel Driver will work.
Path i specified in above statement is correct.I am using Linux.Can u please tell me any other option for this type of testing to get access from excel sheet.
Regards
Anushree
Use a CSV file instead of Excel, or use a real Excel JDBC driver, or parse the Excel yourself using Apache POI. I would recommend CSV files.
Regards,
Narayan
Its working with CSV file,but iam not able to logout, also its not accepting second row.Script used is
_navigateTo("URL", true);
_click(_link("signup"));
function login($email, $pwd)
{
_setValue(_textbox("email"), $email);
_setValue(_password("passwd"), $pwd);
_click(_submit("Log in"));
_click(_link("logout"));
}
var $data=_readCSVFile("/home/users/anushree/test.csv");
for(var $i=0; $i<$data.length; i ++)
{
var $row = $data[$i];
login($row[0], $row[1]);
}
data fomrat present in CSV file
x,y
z,w
Regards
Anushree
Its working.There was a small error.I didtnt specified $ in for loop.
Regards
Anushree
I just saw your program, instead of i it should be $i in loop. ok,you have already figure out the cause. But at the end of loop after taking last username and password,it is taking null value.
Yes you are right its taking null values.I have used following script Please do check it.But its showing success status.Is it the correct way?Because i can see the exception things in log file .
_navigateTo("URL", true);
_click(_link("signup"));
function login($email, $pwd)
{
try
{
_setValue(_textbox("email"), $email);
_setValue(_password("passwd"), $pwd);
_click(_submit("Log in"));
_click(_link("logout"));
}
catch(e)
{
function blankIfNull($s)
{
return ($s == "null" || $s == null) ? "" : $s;
}
$name = blankIfNull($email);
$password = blankIfNull($pwd);
_setValue(_textbox("email"), $name);
_setValue(_password("passwd"), $password);
_logException(e);
}
}
var $data=_readCSVFile("/home/users/anushree/test.csv");
for(var $i=0; $i<$data.length; $i++)
{
var $row = $data[$i];
login($row[0], $row[1]);
}
while plaback its showing the script like this after showing some valid login.
_setValue(_textbox("email"), "");
_setValue(_password("passwd"), null);
_click(_submit("Log in"));
_click(_link("logout"));
_setValue(_textbox("email"), "");
_setValue(_password("passwd"), "");
--Stopped Playback: SUCCESS--
Regards
Anushree
I checked your code.I tried to implement your code. But for me, it is still same. It is taking null value and status
showing Failure. In log file showing 97%.
What is coming in your log file. Is it showing success or what? You are telling that in log showing some exception. what is that? Post or email that log file message. I don't know, why it is not working for me.
Regards
Shashi
Yes you are right.For me also its not working if iam keeping some space in CSV file.If i perform these steps without keeping any space in CSV file then it wil surely work.Actually i put try catch statement so it will take any failures and show in log file and continue with next one.Can u suggest me any step?
Regards
Anushree
You can perform this script.It will work.
function login($email, $pwd)
{
try
{
_setValue(_textbox("email"), $email);
_setValue(_password("passwd"), $pwd);
_click(_submit("Log in"));
_click(_link("logout"));
}
catch(e)
{
_logException(e);
}
}
function blankIfNull($s)
{
return ($s == "null" || $s == null) ? "" : $s;
}
var $name;
var $password;
_navigateTo("URL", true);
_click(_link("signup"));
var $data=_readCSVFile("/home/users/anushree/test.csv");
for(var $i=0; $i<$data.length; $i++)
{
var $row = $data[$i];
$name = blankIfNull($row[0]);
$password = blankIfNull($row[1]);
login($name, $password);
}
Regards
Anushree