foreach (DataRow dr in mydataset.Tables["sitelocation"].Rows)
{
WebDriverWait wait1 = new WebDriverWait(driver, TimeSpan.FromSeconds(5));
wait.Until((d) => { return d.FindElement(By.Id("lblCreatenew")); });
driver.FindElement(By.Id("lblCreatenew")).Click();
wait.Until((d) => { return d.FindElement(By.Id("TxtSiteLocation")); });
driver.FindElement(By.Id("TxtSiteLocation")).Clear();
driver.FindElement(By.Id("TxtSiteLocation")).SendKeys(dr[0].ToString());
driver.FindElement(By.XPath("(//button[@type='button'])[3]")).Click();
wait.Until((d) => { return d.FindElement(By.Id("dialog-confirmSL1")); });
driver.FindElement(By.XPath("(//span[text()='Yes'])")).Click();
wait.Until((d) => { return d.FindElement(By.Id("dialog-confirmSL2")); });
driver.FindElement(By.XPath("(//span[text()='Ok'])")).Click();
}
Regards,
Vasanth