public void AddUserGrouptoApplication(string applicationName, string usergroup, log4net.ILog log) { PageFactory.InitElements(driver, this); USER_GROUPS_link.Click(); Create_New_User_Group_link.Click(); Name_text.SendKeys(usergroup); Description_text.SendKeys(usergroup); Application_dropdown.SendKeys(applicationName); Save_link.Click(); //Asertion Section: string actualUserGroupName; try { actualUserGroupName = Name_text.Text; } catch { Thread.Sleep(1000); PageFactory.InitElements(driver, this); actualUserGroupName = Name_text.Text; } Assert.AreEqual(usergroup, actualUserGroupName); log.Info(Name_text.Text); //Go back to home page... USERS_link.Click(); }
//Methods: public void CreateNewUser(string emailaddress, string firstName, log4net.ILog log) { //Create an instance of the LAFAdmin_ManageUsers_Page //I will just call this instance 'usersPage' for short: log.Info("Test Start: CreateNewUser, username="******"Mr"); First_Name_text.SendKeys(firstName); Last_Name_text.SendKeys("Test"); Country_of_Residence_dropdown.SendKeys("United Kingdom"); Contact_Telephone_Number_text.SendKeys("123"); Are_you_an_insurance_professional_dropdown.SendKeys("No"); Job_title_text.SendKeys("Tester"); Company_name_text.SendKeys("Testing LTD"); Organisation_type_dropdown.SendKeys("Lloyds corporation"); Save_link.Click(); //Assertion: Email_Address_Text.SendKeys(emailaddress); Search_link.Click(); Assert.IsTrue(SEARCH_RESULTS_links.Displayed); log.Info("New User Created Successfully"); try { USERS_link.Click(); } catch { PageFactory.InitElements(driver, this); USERS_link.Click(); } }