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.

not reading data from csv file for data driven testing

ronakronak Members
edited November -1 in Sahi - Open Source
hey all,

i am facing issue working with csv file. I am not getting any error. during playback. but its not inputting any value for email and password from my csv file.

here's is my complete code :


function login($email, $pwd)
{
try
{
__setValue(_textbox("email"), $email);
_click(_submit("Join"));
_click(_label("Enter password"));
_setValue(_password("password"), "$pwd");
_setValue(_password("password_retype"), "$pwd");
_click(_submit("Submit"));
_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("Member Log In"));
_click(_link("Sign Up"));
var $data=_readCSVFile("C:\\New Folder\\ddriven\\test1.csv");
for(var $i=0; $i<$data.length; $i++)
{
var $row = $data[$i];
$name = blankIfNull($row[0]);
$password = blankIfNull($row[1]);
login($name, $password);

}

does the CSV file should be in specific format ??
its just goes into a loop, without extracting any values from CSV.

Please help... ASAP.
Thanks.

Comments

  • narayannarayan Administrators
    This code looks correct. Can you post the csv data too? May be with dummy data, so that we can check the format.
  • ronakronak Members
    email address password

    hdhfgsd


    this are the two columns on csv file

    forum is not allowing me to enter email address, as I am new member.
  • ronakronak Members
    I think my excel format is wrong. it should be fixed. if not, i will keep you posted.
  • narayannarayan Administrators
    Hi Ronak,

    The csv file should have a format like this:

    emailAddress1,password1
    emailAddress2,password2

    Regards,
    Narayan
Sign In or Register to comment.