public void RemoveUserGroupFromApplication(string applicationName, string usergroup, log4net.ILog log, IWebDriver driver)
        {
            USER_GROUPS_link.Click();



            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            Delete_user_group_link.Click();

            Confirm_Deletion_checkbox.Click();
            Confirm_Deletion_Of_User_link.Click();


            //ASsertion delete successful
            try
            {
                USER_GROUPS_link.Click();
            }
            catch (TargetInvocationException)
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);
                USER_GROUPS_link.Click();
            }
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_links));


            //back to home page
            USERS_link.Click();
        }
 public bool doesUserGroupExist(string group)
 {
     USER_GROUPS_link.Click();
     User_Group_Name_text.SendKeys(group);
     PageFactory.InitElements(driver, this);
     Search_link.Click();
     Thread.Sleep(500);
     if (isElementPresent(SEARCH_RESULTS_links))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
        public void DeleteUserFromUserGroup(string emailaddress, string usergroup, log4net.ILog log)
        {
            PageFactory.InitElements(driver, this);
            Thread.Sleep(1000);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);

            try
            {
                Search_link.Click();
                SEARCH_RESULTS_links.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                Search_link.Click();
                SEARCH_RESULTS_links.Click();
            }

            User_Search_text.SendKeys(emailaddress);
            Filter_Users_link.Click();

            SEARCH_RESULTS_checkbox.Click();
            Remove_Users_link.Click();
            //Now asserting that removal was successful:

            try
            {
                User_Search_text.SendKeys(emailaddress);
            }
            catch (TargetInvocationException)
            {
                //Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);

                User_Search_text.SendKeys(emailaddress);
            }

            Filter_Users_link.Click();
            Thread.Sleep(1000);
            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_links));


            log.Info("User '" + emailaddress + "' removed from user group '" + usergroup + "'successfully.");
            USERS_link.Click();
        }
        //Add New Users To USer Groups Screen:

        public void AddUserToUserGroup(string emailaddress, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();

            //Thread.Sleep(1000);
            Add_New_User_link.Click();
            //LAFAdminManageusersPage usersPage = new LAFAdminManageusersPage(driver);

            Email_Address_Text.SendKeys(emailaddress);

            PageFactory.InitElements(driver, this);

            Search_link.Click();



            try
            {
                SEARCH_RESULTS_checkbox.Click();
            }
            catch (TargetInvocationException)
            {
                PageFactory.InitElements(driver, this);
                SEARCH_RESULTS_checkbox.Click();
            }
            Add_Users_to_User_Group_link.Click();
            Thread.Sleep(1000);


            User_Search_text.SendKeys(emailaddress);
            Filter_Users_link.Click();
            Thread.Sleep(1000);
            Assert.IsTrue(isElementPresent(SEARCH_RESULTS_links));

            log.Info("User '" + emailaddress + "' added to user group '" + usergroup + "'successfully.");
            USERS_link.Click();
        }
        public void AddCredentialToUserGroup(string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();


            Add_Credentials_link.Click();

            Credential_name_text.SendKeys(credentialName);
            Credential_value_text.SendKeys(credentialValue);
            try
            {
                Search_link.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, this);
                Search_link.Click();
            }

            SEARCH_RESULTS_checkbox.Click();

            Add_Credentials_to_User_Group_link.Click();

            //Assertion of the above:
            //This should prob be wrapped up in function on the actual page?
            Credential_Search_text.SendKeys(credentialValue);
            Filter_Users_link.Click();

            Assert.IsTrue(isElementPresent(Credential_Search_Results_table));



            log.Info("Credential '" + credentialName + ", value: " + credentialValue + " added to user group '" + usergroup + "'successfully.");

            USERS_link.Click();
        }
        public void RemoveCredentialFromUserGroup(string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();
            User_Group_Name_text.SendKeys(usergroup);
            Search_link.Click();
            SEARCH_RESULTS_links.Click();


            //Assuming here that only one credential will exist with a given value in each group, not neccessarily true
            //in terms of funcitonality, but operationally, this should be the case, fair assumption to make for
            //this level of testing

            Credential_Search_text.SendKeys(credentialValue);
            Credential_Search_Results_checkbox.Click();
            Remove_Selected_Credentials_link.Click();

            //Now asserting if removed...
            try
            {
                Credential_Search_text.SendKeys(credentialValue);
            }
            catch
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, this);
                Credential_Search_text.SendKeys(credentialValue);
            }

            Filter_Users_link.Click();

            Assert.IsFalse(isElementPresent(SEARCH_RESULTS_table));



            USERS_link.Click();
        }
 public void SearchByUserGroupName(string usergroupname, log4net.ILog log)
 {
     User_Group_Name_text.SendKeys(usergroupname);
     Search_link.Click();
 }