public void AddCredentialValueToApplication(string applicationName, string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //instantiate new Adduserdetailspage

            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();


            Application_text.SendKeys(applicationName);
            Search_link.Click();
            APPLICATION_SEARCH_RESULTS_links.Click();

            LAFAdmin_Applications_Page applicationsPage = new LAFAdmin_Applications_Page(driver);

            applicationsPage.credential_Search_text.SendKeys(credentialName);
            applicationsPage.Filter_Credentials_link.Click();
            applicationsPage.Credential_Values_link.Click();
            applicationsPage.Create_New_Values_link.Click();
            applicationsPage.add_values_textbox.SendKeys(credentialValue);
            applicationsPage.Import_link.Click();


            //Assert Credential created:

            applicationsPage.Value_text.SendKeys(credentialValue);
            applicationsPage.Search_link.Click();
            Assert.IsTrue(applicationsPage.isElementPresent(applicationsPage.SEARCH_RESULTS_checkbox));



            //Go to home page
            applicationsPage.USERS_link.Click();
        }
        public void AddCredentialtoApplication(string applicationName, string credentialName, string usergroup, log4net.ILog log)
        {
            //instantiate new USer Group page - as this is the easiest route for finding a specific applicaiton via automation (due to the way the application home page is layed out)
            log.Info("Entered AddCredentialToApplication");
            PageFactory.InitElements(driver, this);
            USER_GROUPS_link.Click();


            Application_text.SendKeys(applicationName);
            Search_link.Click();
            APPLICATION_SEARCH_RESULTS_links.Click();

            //Now we are on the application page - so create an application object
            LAFAdmin_Applications_Page applicationsPage = new LAFAdmin_Applications_Page(driver);

            applicationsPage.Add_Credential_link.Click();
            applicationsPage.credential_Name_text.SendKeys(credentialName);
            applicationsPage.credential_Description_text.SendKeys("Desription Test2");
            applicationsPage.Save_link.Click();

            //Assert Credential created:

            applicationsPage.credential_Search_text.SendKeys(credentialName);
            applicationsPage.Filter_Credentials_link.Click();
            Assert.IsTrue(applicationsPage.isElementPresent(applicationsPage.Credential_Values_link));


            applicationsPage.USERS_link.Click();


            log.Info("At end of AddCredentialTOApplication");
        }
        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 void RemoveCredentialValueFromApplication(string applicationName, string credentialName, string credentialValue, string usergroup, log4net.ILog log)
        {
            //find app via User Groups PAge
            PageFactory.InitElements(driver, this);

            USER_GROUPS_link.Click();


            Application_text.SendKeys(applicationName);
            Search_link.Click();
            APPLICATION_SEARCH_RESULTS_links.Click();

            LAFAdmin_Applications_Page applicationsPage = new LAFAdmin_Applications_Page(driver);

            applicationsPage.credential_Search_text.SendKeys(credentialName);
            applicationsPage.Filter_Credentials_link.Click();
            try
            {
                applicationsPage.Credential_Values_link.Click();
            }
            catch
            {
                PageFactory.InitElements(driver, applicationsPage);
                applicationsPage.Credential_Values_link.Click();
            }


            applicationsPage.Value_text.SendKeys(credentialValue);
            applicationsPage.Search_link.Click();
            applicationsPage.SEARCH_RESULTS_checkbox.Click();

            applicationsPage.Delete_Selected_Credential_Values_link.Click();

            //ASSERT:
            try
            {
                applicationsPage.Value_text.SendKeys(credentialValue);
            }
            catch
            {
                Thread.Sleep(1000);
                PageFactory.InitElements(driver, applicationsPage);
                applicationsPage.Value_text.SendKeys(credentialValue);
            }
            applicationsPage.Search_link.Click();
            Assert.IsFalse(applicationsPage.isElementPresent(applicationsPage.SEARCH_RESULTS_checkbox));



            applicationsPage.USERS_link.Click();

            applicationsPage = null;
        }
 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();
 }
 public void SearchByEmail(string emailaddress, log4net.ILog log)
 {
     Email_Address_Text.SendKeys(emailaddress);
     Search_link.Click();
 }