/// <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.InstitutionsGCEPPage.InstitutionProgramManagmentLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionProgramManagmentLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
                    InstitutionProgramManagmentLnk.Click();
                    Browser.WaitForElement(Bys.ProgramsPage.ProgramMngTbl, TimeSpan.FromSeconds(120), ElementCriteria.IsEnabled, ElementCriteria.IsVisible);
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
                    return(new ProgramsPage(Browser));
                }
            }
            if (Browser.Exists(Bys.InstitutionsGCEPPage.InstitutionCurriculumTmpLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionCurriculumTmpLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    InstitutionCurriculumTmpLnk.Click();
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(120), ElementCriteria.IsNotVisible);
                    return(new CurriculumMngPage(Browser));
                }
            }
            if (Browser.Exists(Bys.InstitutionsGCEPPage.InstitutionUserManagementLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionUserManagementLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    InstitutionUserManagementLnk.Click();
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(120), ElementCriteria.IsNotVisible);
                    return(new GCEPUserMngPage(Browser));
                }
            }
            if (Browser.Exists(Bys.InstitutionsGCEPPage.InstitutionPromotePgyLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionPromotePgyLnk.GetAttribute("outerHTML"))
                {
                    //WaitForInitialize();
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    InstitutionPromotePgyLnk.Click();
                    //Browser.WaitForElement(Bys.PromotePGYPage.AvailableResidentsPromotePGYTblFirstRowChk, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    PromotePGYPage PPGYP = new PromotePGYPage(Browser);
                    // PPGYP.WaitForInitialize();
                    return(PPGYP);
                }
            }
            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);
        }
Пример #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.GCEPPage.UserManageLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == UserManageLnk.GetAttribute("outerHTML"))
                {
                    UserManageLnk.Click();
                    GCEPUserMngPage GPU = new GCEPUserMngPage(Browser);
                    GPU.WaitForInitialize();
                    return(GPU);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.CurriculumTemplatesLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CurriculumTemplatesLnk.GetAttribute("outerHTML"))
                {
                    WaitForInitialize();
                    CurriculumTemplatesLnk.Click();
                    CurriculumMngPage CMP = new CurriculumMngPage(Browser);
                    CMP.WaitForInitialize();
                    return(CMP);
                    //new WebDriverWait(Browser, TimeSpan.FromSeconds(25)).Until(ExpectedConditions.UrlContains("gme-competency/admin/programcurriculumtemplates"));
                }
            }
            if (Browser.Exists(Bys.GCEPPage.LibraryLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LibraryLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    LibraryLnk.Click();
                    GCEPLibraryPage GPL = new GCEPLibraryPage(Browser);
                    GPL.WaitForInitialize();
                    return(GPL);
                    // return  new CurriculumMngPage(Browser);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.TranscriptLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == TranscriptLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, TimeSpan.FromSeconds(90), ElementCriteria.IsNotVisible);
                    TranscriptLnk.Click();
                    GCEPTranscriptPage GCTP = new GCEPTranscriptPage(Browser);
                    GCTP.WaitForInitialize();
                    return(GCTP);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.InstitutionManagLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionManagLnk.GetAttribute("outerHTML"))
                {
                    WaitForInitialize();
                    InstitutionManagLnk.Click();
                    InstitutionsPage IP = new InstitutionsPage(Browser);
                    IP.WaitForInitialize();
                    return(IP);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.DashboardNotificationManageLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == DashboardNotificationManageLnk.GetAttribute("outerHTML"))
                {
                    WaitForInitialize();
                    DashboardNotificationManageLnk.Click();
                    DashboardNotificationsPage DNP = new DashboardNotificationsPage(Browser);
                    DNP.WaitForInitialize();
                    return(DNP);
                }
            }
            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();
                    Thread.Sleep(0500);
                    return(this.Browser);
                    // new WebDriverWait(Browser, TimeSpan.FromSeconds(45)).Until(ExpectedConditions.UrlMatches("https://logintest.ama-assn.org/account/logout"));
                }
            }
            if (Browser.Exists(Bys.GCEPPage.PromotePGYLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PromotePGYLnk.GetAttribute("outerHTML"))
                {
                    WaitForInitialize();
                    PromotePGYLnk.Click();
                    Browser.WaitForElement(Bys.PromotePGYPage.AvailableResidentsPromotePGYTblFirstRowChk, ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    PromotePGYPage PPGYP = new PromotePGYPage(Browser);
                    PPGYP.WaitForInitialize();
                    return(PPGYP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.HelpLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == HelpLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    HelpLnk.SendKeys(Keys.Tab);
                    HelpLnk.Click();
                    HelpPage HP = new HelpPage(Browser);
                    HP.WaitForInitialize();
                    return(HP);
                }
            }
            if (Browser.Exists(Bys.AMAPage.HelpfromYourInstitutionLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == HelpfromYourInstitutionLnk.GetAttribute("outerHTML"))
                {
                    HeaderMenuDropDown.Click();
                    Thread.Sleep(0500);
                    HelpfromYourInstitutionLnk.Click();
                    Browser.SwitchTo().Window(Browser.WindowHandles.Last());
                    Thread.Sleep(0500);
                    Browser.Manage().Window.Maximize();
                    Thread.Sleep(0500);
                    Browser.SwitchTo().Window(Browser.WindowHandles.First()).Close();
                    if (Browser.WindowHandles.Count > 1)
                    {
                        Browser.SwitchTo().Window(Browser.WindowHandles.First()).Close();
                    }
                    Thread.Sleep(0500);
                    Browser.SwitchTo().Window(Browser.WindowHandles.Last());
                    Browser.Manage().Window.Maximize();
                    Thread.Sleep(0500);
                    HelpPage HP = new HelpPage(Browser);
                    HP.WaitForInitialize();
                    return(HP);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.ResidentCouseStartNowBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ResidentCouseStartNowBtn.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    ResidentCouseStartNowBtn.Click();
                    CourseTestPage CTP = new CourseTestPage(Browser);
                    CTP.WaitForInitialize();
                    return(CTP);
                }
            }
            if (Browser.Exists(Bys.GCEPPage.MemberBenefitsManagementLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MemberBenefitsManagementLnk.GetAttribute("outerHTML"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    MemberBenefitsManagementLnk.Click();
                    MemberBenefitPage MBP = new MemberBenefitPage(Browser);
                    MBP.WaitForInitialize();
                    return(MBP);
                }
            }
            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);
        }