public void EnterDetails(Table table) { foreach (var row in table.Rows) { switch (row[0].ToLower()) { case "approved": var approved = Convert.ToBoolean(row[1]); if ((Approved.Selected && !approved) || (!Approved.Selected && approved)) { Approved.Click(); } break; case "emailverified": var emailVerified = Convert.ToBoolean(row[1]); if ((EmailVerified.Selected && !emailVerified) || (!EmailVerified.Selected && emailVerified)) { EmailVerified.Click(); } break; case "enabled": var enabled = Convert.ToBoolean(row[1]); if ((Enabled.Selected && !enabled) || (!Enabled.Selected && enabled)) { Enabled.Click(); } break; case "firstname": FirstName.Clear(); FirstName.SendKeys(row[1]); break; case "lastname": LastName.Clear(); LastName.SendKeys(row[1]); break; case "postcode": PostCode.Clear(); PostCode.SendKeys(row[1]); break; case "skypename": SkypeName.Clear(); SkypeName.SendKeys(row[1]); break; case "hometelephonenumber": TelNoHome.Clear(); TelNoHome.SendKeys(row[1]); break; case "mobiletelephonenumber": TelNoMobile.Clear(); TelNoMobile.SendKeys(row[1]); break; case "worktelephonenumber": TelNoWork.Clear(); TelNoWork.SendKeys(row[1]); break; case "title": Title.Clear(); Title.SendKeys(row[1]); break; case "town": Town.Clear(); Town.SendKeys(row[1]); break; default: throw new Exception(string.Format("Field {0} not defined", row[0])); } } }