Exemple #1
0
        ///// <summary>
        ///// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        ///// depending on the button that was clicked
        ///// </summary>
        ///// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.EducationCenterPage.GcepLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == GcepLnk.GetAttribute("outerHTML"))
                {
                    GcepLnk.SendKeys(Keys.Tab);  // Have to tab here, because in firefox, the menu item doesnt expand when we use the Selenium Click method. We first have to tab to expand
                    GcepLnk.Click();
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(120), ElementCriteria.IsNotVisible);
                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("gme-competency/admin"));
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(360)).Until(ExpectedConditions.InvisibilityOfElementLocated(Bys.AMAPage.LoadIcon));
                    // Browser.SwitchTo().Frame(G.EnterACPDFrame);
                }
            }
            if (Browser.Exists(Bys.EducationCenterPage.TranscriptLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == TranscriptLnk.GetAttribute("outerHTML"))
                {
                    TranscriptLnk.Click();
                    return(new EducationCenterTransciptPage(Browser));
                    // Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    // Browser.SwitchTo().Frame(G.EnterACPDFrame);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(20)).Until(ExpectedConditions.UrlContains("gme-competency/admin"));
                }
            }
            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
Exemple #2
0
        ///// <summary>
        ///// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        ///// depending on the button that was clicked
        ///// </summary>
        ///// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.GCEPUserMngPage.UserLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == UserLnk.GetAttribute("outerHTML"))
                {
                    UserLnk.Click();
                    Browser.WaitForElement(Bys.UserManagementPage.SaveBtn, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("users/manageuser"));
                    // Browser.SwitchTo().Frame(G.EnterACPDFrame);
                    return(new UserManagementPage(Browser));
                }
            }
            if (Browser.Exists(Bys.AMAPage.GMECompetencyEducationProgramLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == GMECompetencyEducationProgramLnk.GetAttribute("outerHTML")) // GMECompetencyEducationProgramLnk.GetAttribute("outerHTML"))
                {
                    GMECompetencyEducationProgramLnk.SendKeys(Keys.Tab);                                                      // AdministrationLnk
                    GMECompetencyEducationProgramLnk.Click();
                    // AdministrationLnk.Click();
                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
            }
            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
        /// <summary>
        /// This method compare Institution contact email adress with contact email adress from UI
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="Institutions">List of Institution names</param>
        /// <param name="InstitutionContactEmails">List Of Institutions contact email adresses</param>
        /// <returns></returns>
        public static Boolean ComparingInstitutionEmailsWithHelpContactEmails(IWebDriver browser, List <string> Institutions, List <string> InstitutionContactEmails)
        {
            GCEPPage GP = new GCEPPage(browser);
            HelpPage HP = new HelpPage(browser);

            if (Institutions.Count - 1 == InstitutionContactEmails.Count)
            {
                // Starting the for loop on the 2nd row (index = 1) on the for loop here because when we extracted the values from the dropdown
                //  above, the first value was not an institution, it was a static "Select your item" text
                for (var i = 1; i < Institutions.Count; i++)
                {
                    GP = HP.ClickToAdvance(HP.GMECompetencyEducationProgramLnk); //(HP.AdministrationLnk)
                    GP.InstitutionSelElem.SelectByText(Institutions[i].ToString());
                    GP.WaitForInitialize();
                    HP = GP.ClickToAdvance(GP.HelpfromYourInstitutionLnk);                                           //GP.ClickToAdvance(GP.HelpLnk);
                    Thread.Sleep(0500);
                    Assert.True(InstitutionContactEmails[i - 1].Equals(HP.ContactInvolvedInstitutionEmailLnk.Text)); //==firefox failure
                    Assert.True(HP.GMECompetencyEducationProgramLnk.Displayed);                                      //HP.AdministrationLnk.Displayed
                    Assert.True(HP.AdminWatchVideoLnk.Displayed);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.InstitutionsPage.EditInstitutionLnk))
            {
                if (buttonOrLinkElem.GetAttribute("id") == EditInstitutionLnk.GetAttribute("id"))
                {
                    EditInstitutionLnk.Click();
                    EditInstitutionPage EIP = new EditInstitutionPage(Browser);
                    EIP.WaitForInitialize();
                    return(EIP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.AdministrationLnk))
            {
                if (buttonOrLinkElem.GetAttribute("id") == GMECompetencyEducationProgramLnk.GetAttribute("id")) // AdministrationLnk.GetAttribute("outerHTML"))
                {
                    GMECompetencyEducationProgramLnk.Click();                                                   // AdministrationLnk.Click();
                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
            }
            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }
Exemple #5
0
        /// <summary>
        /// again mike
        /// </summary>
        /// <param name="LinkText"></param>
        /// <returns></returns>
        public dynamic ClickToBreadCrumbContainerToReturnGcep(string LinkText)
        {
            string      xPathVariable      = string.Format("//li/a[contains(.,'{0}')]", LinkText);
            IWebElement BreadCrumpWithName = Browser.FindElement(By.XPath(xPathVariable));

            BreadCrumpWithName.Click();
            Thread.Sleep(1000);
            GCEPPage GP = new GCEPPage(Browser);

            GP.WaitForInitialize();
            return(GP);
        }
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.DashboardNotificationsPage.CreateNotificationBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateNotificationBtn.GetAttribute("outerHTML"))
                {
                    CreateNotificationBtn.Click();
                    //Browser.WaitForElement(Bys.NotificationCreatorPage.SaveExitBtn, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("/add"));
                    NotificationCreatorPage NCP = new NotificationCreatorPage(Browser);
                    NCP.WaitForInitialize();
                    return(NCP);
                }
                if (Browser.Exists(Bys.AMAPage.SignOutLnk))
                {
                    if (buttonOrLinkElem.GetAttribute("outerHTML") == SignOutLnk.GetAttribute("outerHTML"))
                    {
                        Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                        HeaderMenuDropDown.Click();
                        SignOutLnk.SendKeys(Keys.Tab);
                        SignOutLnk.Click();
                        //new WebDriverWait(Browser, TimeSpan.FromSeconds(65)).Until(ExpectedConditions.UrlMatches("https://logintest.ama-assn.org/account/logout"));
                        return(this.Browser);
                    }
                }
                if (Browser.Exists(Bys.AMAPage.GMECompetencyEducationProgramLnk))
                {
                    if (buttonOrLinkElem.GetAttribute("outerHTML") == GMECompetencyEducationProgramLnk.GetAttribute("outerHTML"))
                    {
                        GMECompetencyEducationProgramLnk.Click();
                        //Browser.WaitForElement(Bys.NotificationCreatorPage.SaveExitBtn, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                        //new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("/add"));
                        GCEPPage GCEP = new GCEPPage(Browser);
                        GCEP.WaitForInitialize();
                        return(GCEP);
                    }
                }
                else
                {
                    throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
                }
            }

            return(null);
        }
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.AMAPage.GMECompetencyEducationProgramLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == GMECompetencyEducationProgramLnk.GetAttribute("outerHTML"))
                {
                    GMECompetencyEducationProgramLnk.Click();
                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
            }
            // if (Browser.Exists(Bys.GCEPLibraryPage.BeginCourseBtn))
            // {
            //      if (buttonOrLinkElem.GetAttribute("outerHTML") == BeginCourseBtn.GetAttribute("outerHTML"))
            //      {
            //            BeginCourseBtn.Click();
            //            return new CourseTestPage(Browser);
            //      }
            // }

            //if (Browser.Exists(Bys.GCEPLibraryPage.TranscriptLnk))
            //{
            //    if (buttonOrLinkElem.GetAttribute("outerHTML") == TranscriptLnk.GetAttribute("outerHTML"))
            //    {
            //        TranscriptLnk.Click();
            //         Browser.WaitForElement(Bys.GCEPTranscriptPage.CompletedTestTbl, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);

            //        return new GCEPTranscriptPage(Browser);
            //    }
            //}
            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }


            return(null);
        }
Exemple #8
0
 /// <summary>
 /// Enters text in the username and password field, clicks the login button, then waits for the URL
 /// of the Library page to load
 /// </summary>
 /// <param name="userName"></param>
 /// <param name="password"></param>
 public dynamic UnassignCurriculum()
 {
     try {
         do
         {
             ActionBtn.Click();
             UnassignCurriculumLnk.Click();
             Thread.Sleep(0500);
             AcceptBtn.Click();
             Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
         }while (ActionBtn.Displayed);
     }
     catch (NoSuchElementException)
     {
         GCEPPage Gcep = new GCEPPage(Browser);
         // Gcep.GMECompetencyEducationProgramLnk.Click();
         Browser.Navigate().Back();
         Gcep.WaitForInitialize();
         return(Gcep);
     }
     return(null);
 }
Exemple #9
0
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.AMAPage.GMECompetencyEducationProgramLnk))                                                 //AdministrationLnk
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == GMECompetencyEducationProgramLnk.GetAttribute("outerHTML")) // AdministrationLnk.GetAttribute("outerHTML"))
                {
                    GMECompetencyEducationProgramLnk.Click();                                                                 //AdministrationLnk.Click();
                    // Browser.WaitForElement(Bys.EducationCenterPage.MyCoursesTtl, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    //Browser.WaitForElement(Bys.EducationCenterPage.GcepLnk, TimeSpan.FromSeconds(60), ElementCriteria.IsEnabled);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("Courses.aspx"));

                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
                else
                {
                    throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
                }
            }

            return(null);
        }
        /// <summary>
        /// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        /// depending on the button that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.PromotePGYPage.FormConfirmBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == FormConfirmBtn.GetAttribute("outerHTML"))
                {
                    //Browser.SwitchTo().Frame(PostTestFrame);
                    FormConfirmBtn.Click();
                    Browser.WaitForElement(Bys.GCEPPage.SendEmailNotificationLnk, TimeSpan.FromSeconds(120), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("gme-competency/admin"));

                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
                else
                {
                    throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
                }
            }

            return(null);
        }
        ///// <summary>
        ///// Clicks the user-specified button or link and then waits for a window to close or open, or a page to load,
        ///// depending on the button that was clicked
        ///// </summary>
        ///// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickToAdvance(IWebElement buttonOrLinkElem)
        {
            if (Browser.Exists(Bys.AMAPage.SignOutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SignOutLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    HeaderMenuDropDown.Click();
                    SignOutLnk.SendKeys(Keys.Tab);
                    SignOutLnk.Click();
                    //Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);

                    // return  new CurriculumMngPage(Browser);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(115)).Until(ExpectedConditions.UrlMatches("https://logintest.ama-assn.org/account/logout"));
                    return(this.Browser);
                }
            }

            if (Browser.Exists(Bys.CurriculumMngPage.CurrulumTemplatesHeader))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateCurriculumTemplateBtn.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.UrlContains("gme-competency/admin/curriculumtemplates"));
                    CreateCurriculumTemplateBtn.Click();
                    //Thread.Sleep(3000);
                    //Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsEnabled);
                    Browser.WaitForElement(Bys.CurriculumCoursePage.AvailableCoursesTbl, ElementCriteria.IsVisible);
                    //  new WebDriverWait(Browser, TimeSpan.FromSeconds(35)).Until(ExpectedConditions.UrlContains("gme-competency/admin/curriculumtemplates/course"));

                    CurriculumCoursePage CCP = new CurriculumCoursePage(Browser);
                    CCP.WaitForInitialize();
                    return(CCP);
                }
            }

            if (Browser.Exists(Bys.CurriculumMngPage.AssignToProgrammLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AssignToProgrammLnk.GetAttribute("outerHTML"))
                {
                    // Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    //  new WebDriverWait(Browser, TimeSpan.FromSeconds(15)).Until(ExpectedConditions.UrlContains("gme-competency/admin/curriculumtemplates"));
                    // CurriculumMngPage.Actioncell.Click();
                    AssignToProgrammLnk.Click();
                    Browser.WaitForElement(Bys.AssignProgramPage.StartDateCalenderBox, TimeSpan.FromSeconds(240), ElementCriteria.IsVisible);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(35)).Until(ExpectedConditions.UrlContains("gme-competency/admin/curriculumtemplates/curriculumprogramtimeframe"));

                    // Browser.SwitchTo().Frame(G.EnterACPDFrame);
                    AssignProgramPage APP = new AssignProgramPage(Browser);
                    APP.WaitForInitialize();
                    return(APP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.AdministrationLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == GMECompetencyEducationProgramLnk.GetAttribute("outerHTML")) //AdministrationLnk.GetAttribute("outerHTML"))
                {
                    GMECompetencyEducationProgramLnk.Click();                                                                 // AdministrationLnk.Click();
                    GCEPPage GP = new GCEPPage(Browser);
                    GP.WaitForInitialize();
                    return(GP);
                }
            }
            else
            {
                throw new Exception("No button or link was found with your passed parameter. You either need to add this button to a new If statement, or if the button is already added, then the page you were on did not contain the button.");
            }

            return(null);
        }