Exemplo n.º 1
0
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, and then waits for a window to close or open,
        /// or a page to load, depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            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
        /// <summary>
        /// Clicks the user-specified element that exists on every page of RCP, and then waits for a window to close or open,
        /// or a page to load, depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The element to click on</param>
        public dynamic ClickAndWaitBasePage(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.RCPPage.PERAFCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PERAFCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    PERCredentialStaffPage page = new PERCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDiplomaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDiplomaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    DiplomaCredentialStaffPage page = new DiplomaCredentialStaffPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyDashboardTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyDashboardTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyDashboardPage page = new MyDashboardPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyCPDActivitiesTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyCPDActivitiesTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyCPDActivitiesListPage page = new MyCPDActivitiesListPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyMOCTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyMOCTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyMOCPage page = new MyMOCPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.MyHoldingAreaTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == MyHoldingAreaTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();
                    return(page);
                }
            }

            if (Browser.Exists(Bys.RCPPage.CBDTab))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CBDTab.GetAttribute("outerHTML"))
                {
                    // Using javascript based click because firefox doesnt click on these tabs using Selenium based click. Might be a current geckodriver bug. Revisit
                    JavascriptUtils.Click(Browser, buttonOrLinkElem);
                    // We dont want wait criteria here, because clicking this tab can be on any role within RCP, so there can be many things to wait for
                    return(null);
                }
            }


            if (Browser.Exists(Bys.RCPPage.LogoutLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == LogoutLnk.GetAttribute("outerHTML"))
                {
                    LogoutLnk.Click();
                    this.WaitForElement(Bys.RCPPage.LoginLnk, ElementCriteria.IsVisible);
                    return(null);
                }
            }

            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 element and then waits for a window to close or open, or a page to load,
        /// depending on the element that was clicked
        /// </summary>
        /// <param name="buttonOrLinkElem">The button element</param>
        public dynamic ClickAndWait(IWebElement buttonOrLinkElem)
        {
            // Error handler to make sure that the button that the tester passed in the parameter is actually on the page
            if (Browser.Exists(Bys.MyDashboardPage.EnterACPDActivityBtn))
            {
                // This is a workaround to be able to use an IF statement on an IWebElement type.
                if (buttonOrLinkElem.GetAttribute("outerHTML") == EnterACPDActivityBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    Browser.WaitForElement(Bys.EnterCPDActivityPage.EnterACPDFrame, ElementCriteria.IsVisible);
                    EnterCPDActivityPage EAP = new EnterCPDActivityPage(Browser);
                    EAP.WaitForInitialize();
                    Browser.SwitchTo().Frame(EAP.EnterACPDFrame);
                    return(EAP);
                }
            }

            if (Browser.Exists(Bys.MyDashboardPage.AddAGoalBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == AddAGoalBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    SwitchToFrame(Bys.MyDashboardPage.CreateAGoalFrame, CreateAGoalFrame, Bys.MyDashboardPage.CreateAGoalFormNextBtnTxt);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.MyDashboardPage.CreateAGoalFormNextBtnTxt))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateAGoalFormNextBtnTxt.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.MyDashboardPage.CreateAGoalFormCloseBtnVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.MyDashboardPage.CreateAGoalFormCloseBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CreateAGoalFormCloseBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.MyDashboardPage.TotalCreditsAppliedValueLblVisible);
                    return(null);
                }
            }

            if (Browser.Exists(Bys.MyDashboardPage.ViewMoreBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == ViewMoreBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    MyHoldingAreaPage page = new MyHoldingAreaPage(Browser);
                    page.WaitForInitialize();

                    return(page);
                }
            }

            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);
        }