示例#1
0
        /// <summary>
        /// searching for a specific Institutions and getting contact email adress and saving them on the List of strings
        /// </summary>
        /// <param name="browser"></param>
        /// <param name="Institutions">the List of Institutions for which you are looking email adress </param>
        /// <returns></returns>
        public static List <string> GetTheInstutionsEmail(IWebDriver browser, List <string> Institutions)
        {
            EditInstitutionPage EIP = new EditInstitutionPage(browser);
            InstitutionsPage    IP  = new InstitutionsPage(browser);
            List <string>       InstitutionContactEmails = new List <string>();

            // 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++)
            {
                IP.Search(Institutions[i]);
                IP.ActionGearBtn.Click();
                Thread.Sleep(0500);
                EIP = IP.ClickToAdvance(IP.EditInstitutionLnk);
                InstitutionContactEmails.Add(EIP.InstitutionPrimaryContactEmailTxt.GetAttribute("value"));
                IP = EIP.ClickToAdvance(EIP.InstitutionCancelBtn);
            }

            return(InstitutionContactEmails);
        }
示例#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);
        }
示例#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.EditInstitutionPage.InstitutionSaveBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionSaveBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, InstitutionSaveBtn);
                    Thread.Sleep(0500);
                    InstitutionSaveBtn.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"));

                    InstitutionsPage IP = new InstitutionsPage(Browser);
                    IP.WaitForInitialize();
                    return(IP);
                }
            }
            if (Browser.Exists(Bys.EditInstitutionPage.InstitutionCancelBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == InstitutionCancelBtn.GetAttribute("outerHTML"))
                {
                    ElemSet.ScrollToElement(Browser, InstitutionCancelBtn);
                    Thread.Sleep(0500);
                    InstitutionCancelBtn.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"));

                    InstitutionsPage IP = new InstitutionsPage(Browser);
                    IP.WaitForInitialize();
                    return(IP);
                }
            }
            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"))
                {
                    Browser.WaitForElement(Bys.AMAPage.LoadIcon, ElementCriteria.IsNotVisible);
                    HeaderMenuDropDown.Click();
                    HelpfromYourInstitutionLnk.SendKeys(Keys.Tab);
                    HelpfromYourInstitutionLnk.Click();
                    Browser.Manage().Window.Maximize();

                    Browser.SwitchTo().Window(Browser.WindowHandles.Last());
                    Browser.Manage().Window.Maximize();
                    HelpPage HP = new HelpPage(Browser);
                    HP.WaitForInitialize();
                    return(HP);
                }
            }
            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);
        }