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.
Parameterization Issue with string append
I am trying to do a simple a test case, where i am loggin in to a website and logging off . I Have parameterized it with couple of usernames and their respective passwords saved in the excel sheet.
Login is working totally fine , while logging off is having an issue since the log off link has
Logoff "username" and sahi is not able to do the log off if it is parameterized.
Getting a syntax error:
Error: Expected ")"
My excel:
username password
admin admin1
user user1
My code:
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Sahi_Excel\\Sahi_Data.xlsx;readOnly=false", "", "");
if(db!=null)
{
$rs = db.select("select * from [Sheet1$]");
for($i=0; $i<$rs.length; $i++)
{
login_eams($rs[$i]["username"], $rs[$i]["password"])
}
}
function login_eams($username,$password)
{
_setValue(_textbox("name"), $username);
_setValue(_password("password"), $password);
_click(_submit("Submit"));
_click(_div("Actions"));
_click(_div("View"));
_click(_button("Search"));
_click(_div("Logoff "$username));
}
The valid Log off statement is :
_click(_div("Logoff \"admin\""));
Tried various combinations but not able to append the parameterized username to logoff.
Any help would be greatly appreciated!
Login is working totally fine , while logging off is having an issue since the log off link has
Logoff "username" and sahi is not able to do the log off if it is parameterized.
Getting a syntax error:
Error: Expected ")"
My excel:
username password
admin admin1
user user1
My code:
var db = _getDB("sun.jdbc.odbc.JdbcOdbcDriver", "jdbc:odbc:Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=C:\\Sahi_Excel\\Sahi_Data.xlsx;readOnly=false", "", "");
if(db!=null)
{
$rs = db.select("select * from [Sheet1$]");
for($i=0; $i<$rs.length; $i++)
{
login_eams($rs[$i]["username"], $rs[$i]["password"])
}
}
function login_eams($username,$password)
{
_setValue(_textbox("name"), $username);
_setValue(_password("password"), $password);
_click(_submit("Submit"));
_click(_div("Actions"));
_click(_div("View"));
_click(_button("Search"));
_click(_div("Logoff "$username));
}
The valid Log off statement is :
_click(_div("Logoff \"admin\""));
Tried various combinations but not able to append the parameterized username to logoff.
Any help would be greatly appreciated!
This discussion has been closed.
Comments
I got that to work by giving the DIV id instead of the label($username) in the statement.
_click(_div("div id"));
you can also try with
_click(_div("/logout/"));
This should work.
Thanks,
Regards,
Theeran.
It works perfectly!
Appreciate It!