Example #1
0
        /// <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 element to click on</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.DistributionPage.PortalsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == PortalsLnk.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    this.WaitUntil(Criteria.DistributionPage.AddNewPortalsLnkVisible);
                    return(null);
                }
            }
            if (Browser.Exists(Bys.DistributionPage.CatalogsLnk))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == CatalogsLnk.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    CatalogsPage Page = new CatalogsPage(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);
        }
        /// <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 element to click on</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.AddCatalogPage.DetailsTabCancelBtn))
            {
                if (buttonOrLinkElem.GetAttribute("outerHTML") == DetailsTabCancelBtn.GetAttribute("outerHTML"))
                {
                    buttonOrLinkElem.Click();
                    CatalogsPage page = new CatalogsPage(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);
        }