/// <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.NotificationCreatorPage.SaveExitBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == SaveExitBtn.GetAttribute("outerHTML"))
                {
                    SaveExitBtn.Click();
                    // Browser.WaitForElement(Bys.EducationCenterPage.MyCoursesTtl, TimeSpan.FromSeconds(60), ElementCriteria.IsVisible, ElementCriteria.IsEnabled);
                    Browser.WaitForElement(Bys.DashboardNotificationsPage.CreateNotificationBtn, TimeSpan.FromSeconds(90), ElementCriteria.IsEnabled);
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(90)).Until(ExpectedConditions.UrlContains("gme-competency/admin/dashboardcontent"));
                    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);
                    SignOutLnk.SendKeys(Keys.Tab);
                    SignOutLnk.Click();
                    new WebDriverWait(Browser, TimeSpan.FromSeconds(115)).Until(ExpectedConditions.UrlMatches("https://logintest.ama-assn.org/account/logout"));
                    return(this.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);
        }
Exemplo n.º 2
0
        public dynamic UseDropDownOnRightSide(IWebElement LinkToClick)
        {
            HeaderMenuDropDown.Click();
            Thread.Sleep(200);
            if (LinkToClick.GetAttribute("outerHTML") == SignOutLnk.GetAttribute("outerHTML"))
            {
                SignOutLnk.Click();
                new WebDriverWait(Browser, TimeSpan.FromSeconds(45)).Until(ExpectedConditions.UrlMatches("https://logintest.ama-assn.org/account/logout"));
                return(this.Browser);
            }
            if (LinkToClick.GetAttribute("outerHTML") == HelpfromYourInstitutionLnk.GetAttribute("outerHTML"))
            {
                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);
            }

            return(null);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 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.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);
        }