driver.Navigate().GoToUrl(baseURL);
SqlCommand comm = new SqlCommand();
comm.Connection = new SqlConnection("Data Source=DANJANEYULU\\SQLEXPRESS;" + "Initial Catalog=Userdata; Trusted_Connection=Yes"); //Windows Authentication
string sql = @"select Username,Password from Userdata";
comm.CommandText = sql;
comm.Connection.Open();
SqlDataReader cursor = comm.ExecuteReader();
while (cursor.Read())
{
string username=cursor["Username"].ToString();
string password = cursor["Password"].ToString();
driver.Navigate().GoToUrl(baseURL);
driver.FindElement(By.LinkText("REGISTER")).Click();
driver.FindElement(By.Name("email")).SendKeys(username);
driver.FindElement(By.Name("password")).SendKeys(password);
driver.FindElement(By.Name("confirmPassword")).SendKeys(password);
}
comm.Connection.Close();
SqlCommand comm = new SqlCommand();
comm.Connection = new SqlConnection("Data Source=DANJANEYULU\\SQLEXPRESS;" + "Initial Catalog=Userdata; Trusted_Connection=Yes"); //Windows Authentication
string sql = @"select Username,Password from Userdata";
comm.CommandText = sql;
comm.Connection.Open();
SqlDataReader cursor = comm.ExecuteReader();
while (cursor.Read())
{
string username=cursor["Username"].ToString();
string password = cursor["Password"].ToString();
driver.Navigate().GoToUrl(baseURL);
driver.FindElement(By.LinkText("REGISTER")).Click();
driver.FindElement(By.Name("email")).SendKeys(username);
driver.FindElement(By.Name("password")).SendKeys(password);
driver.FindElement(By.Name("confirmPassword")).SendKeys(password);
}
comm.Connection.Close();
Thanks Man. I am looking for this type of example from long time. your effort is much Appreciated.
ReplyDeletethank you so much :)
ReplyDeleteHi Anjaneyulu thanks for this small tutorial.can you help me how to do same data driven testing using excel sheet
ReplyDelete