public ContactHelper FillContactForm(ContactData contact) { if (contact.Firstname != null) { driver.FindElement(By.Name("firstname")).Clear(); driver.FindElement(By.Name("firstname")).SendKeys(contact.Firstname); } if (contact.Lastname != null) { driver.FindElement(By.Name("lastname")).Clear(); driver.FindElement(By.Name("lastname")).SendKeys(contact.Lastname); } if (contact.Middlename != null) { driver.FindElement(By.Name("middlename")).Clear(); driver.FindElement(By.Name("middlename")).SendKeys(contact.Middlename); } if (contact.Nickname != null) { driver.FindElement(By.Name("nickname")).Clear(); driver.FindElement(By.Name("nickname")).SendKeys(contact.Nickname); } if (contact.Title != null) { driver.FindElement(By.Name("title")).Clear(); driver.FindElement(By.Name("title")).SendKeys(contact.Title); } if (contact.Company != null) { driver.FindElement(By.Name("company")).Clear(); driver.FindElement(By.Name("company")).SendKeys(contact.Company); } if (contact.Address != null) { driver.FindElement(By.Name("address")).Clear(); driver.FindElement(By.Name("address")).SendKeys(contact.Address); } if (contact.HomePhone != null) { driver.FindElement(By.Name("home")).Clear(); driver.FindElement(By.Name("home")).SendKeys(contact.HomePhone); } if (contact.WorkPhone != null) { driver.FindElement(By.Name("work")).Clear(); driver.FindElement(By.Name("work")).SendKeys(contact.WorkPhone); } if (contact.MobilePhone != null) { driver.FindElement(By.Name("mobile")).Clear(); driver.FindElement(By.Name("mobile")).SendKeys(contact.MobilePhone); } if (contact.Fax != null) { driver.FindElement(By.Name("fax")).Clear(); driver.FindElement(By.Name("fax")).SendKeys(contact.Fax); } if (contact.Email1 != null) { driver.FindElement(By.Name("email")).Clear(); driver.FindElement(By.Name("email")).SendKeys(contact.Email1); } if (contact.Email2 != null) { driver.FindElement(By.Name("email2")).Clear(); driver.FindElement(By.Name("email2")).SendKeys(contact.Email2); } if (contact.Email3 != null) { driver.FindElement(By.Name("email3")).Clear(); driver.FindElement(By.Name("email3")).SendKeys(contact.Email3); } if (contact.Homepage != null) { driver.FindElement(By.Name("homepage")).Clear(); driver.FindElement(By.Name("homepage")).SendKeys(contact.Homepage); } /* // fill birth date=14.06.1984 * new SelectElement(driver.FindElement(By.Name("bday"))).SelectByText("14"); * driver.FindElement(By.XPath("//option[16]")).Click(); * driver.FindElement(By.Name("bmonth")).Click(); * new SelectElement(driver.FindElement(By.Name("bmonth"))).SelectByText("June"); * driver.FindElement(By.XPath("//option[@value='June']")).Click(); * driver.FindElement(By.Name("byear")).Click(); * driver.FindElement(By.Name("byear")).Clear(); * driver.FindElement(By.Name("byear")).SendKeys("1984"); * driver.FindElement(By.Name("aday")).Click();*/ return(this); }