private HtmlAnchor GetPageLinkByTitleFromSemanticNavigation(string cssClass, string pageTitle, bool isParentPage = true)
        {
            HtmlControl nav = null;

            if (isParentPage)
            {
                nav = this.EM.Navigation.NavigationWidgetFrontend.GetSemanticNavigation(cssClass);
            }
            else
            {
                nav = this.EM.Navigation.NavigationWidgetFrontend.GetSemanticNavigationChild(cssClass);
            }

            nav.AssertIsNotNull("Navigation");
            HtmlAnchor link = nav.ChildNodes.Where(n => n.InnerText.Contains(pageTitle)).FirstOrDefault().As <HtmlAnchor>();

            if (link == null || !link.IsVisible())
            {
                throw new ArgumentNullException("Link not found");
            }
            else
            {
                return(link);
            }
        }
        /// <summary>
        /// Wait for Preview button and click it
        /// <summary>
        private void WaitForPreviewButtonAndClickIt()
        {
            HtmlAnchor previewLink = EM.Forms.FormsBackend.PreviewButton;

            previewLink.Wait.ForExists();
            Assert.IsNotNull(previewLink, "The Preview button was not found.");
            Assert.IsTrue(previewLink.IsVisible(), "The Preview button was not visible.");
            previewLink.Click();
        }
Пример #3
0
        /// <summary>
        /// Apply css class
        /// </summary>
        public void ClickPreviewButton()
        {
            HtmlAnchor previewLink = ActiveBrowser.Find.ByExpression <HtmlAnchor>("tagname=a", "href=~Preview");

            Manager.Current.SetNewBrowserTracking(true);
            previewLink.Wait.ForExists();
            Assert.IsNotNull(previewLink, "The Preview button was not found.");
            Assert.IsTrue(previewLink.IsVisible(), "The Preview button was not visible.");
            previewLink.Click();
            Manager.Current.WaitForNewBrowserConnect("Preview", true, Manager.Current.Settings.ClientReadyTimeout);
            Manager.Current.SetNewBrowserTracking(false);
        }
Пример #4
0
        /// <summary>
        /// Verifies the news titles on the page frontend.
        /// </summary>
        /// <param name="newsTitles">The news titles.</param>
        /// <returns>true or false depending on news titles presence on frontend</returns>
        public bool IsNewsTitlesPresentOnThePageFrontend(string[] newsTitles)
        {
            HtmlDiv frontendPageMainDiv = BAT.Wrappers().Frontend().Pages().PagesWrapperFrontend().GetPageContent();

            for (int i = 0; i < newsTitles.Length; i++)
            {
                HtmlAnchor newsAnchor = frontendPageMainDiv.Find.ByExpression <HtmlAnchor>("tagname=a", "InnerText=" + newsTitles[i]);
                if ((newsAnchor == null) || (newsAnchor != null && !newsAnchor.IsVisible()))
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Verifies the tags titles on the frontend page.
        /// </summary>
        /// <param name="tagsTitles">The tags titles.</param>
        /// <returns>true or false depending on tags titles presence on frontend</returns>
        public bool IsTagsTitlesPresentOnTheFrontendPage(string[] tagsTitles)
        {
            HtmlDiv frontendPageMainDiv = BAT.Wrappers().Frontend().Pages().PagesWrapperFrontend().GetPageContent();

            for (int i = 0; i < tagsTitles.Length; i++)
            {
                HtmlAnchor tagsAnchor = frontendPageMainDiv.Find.ByExpression <HtmlAnchor>("tagname=a", "InnerText=" + tagsTitles[i]);
                if (tagsAnchor == null || !tagsAnchor.IsVisible())
                {
                    return(false);
                }
            }

            return(true);
        }
        /// <summary>
        /// Verifies the categories titles on the frontend page.
        /// </summary>
        /// <param name="categoriesTitles">The categories titles.</param>
        /// <returns>true or false depending on categories titles presence on frontend</returns>
        public bool IsCategoriesTitlesPresentOnTheFrontendPage(string[] categoriesTitles)
        {
            ActiveBrowser.WaitForElementWithCssClass("sfPublicWrapper");
            HtmlDiv frontendPageMainDiv = BAT.Wrappers().Frontend().Pages().PagesWrapperFrontend().GetPageContent();

            for (int i = 0; i < categoriesTitles.Length; i++)
            {
                HtmlAnchor categoriesAnchor = frontendPageMainDiv.Find.ByExpression <HtmlAnchor>("tagname=a", "InnerText=" + categoriesTitles[i]);
                if (categoriesAnchor == null || !categoriesAnchor.IsVisible())
                {
                    return(false);
                }
            }

            return(true);
        }
        private HtmlAnchor GetPageLinkByTitleFromFoundationNavigation(string cssClass, string pageTitle)
        {
            HtmlControl list = this.EM.Navigation.NavigationWidgetFrontend.GetFoundationNavigation(cssClass)
                               .AssertIsNotNull("list");

            HtmlListItem listItem = list.ChildNodes.Where(i => i.InnerText.Contains(pageTitle)).FirstOrDefault().As <HtmlListItem>()
                                    .AssertIsPresent <HtmlListItem>("List Item");

            HtmlAnchor link = listItem.Find.ByExpression <HtmlAnchor>("InnerText=" + pageTitle);

            if (link == null || !link.IsVisible())
            {
                throw new ArgumentNullException("Link not found");
            }
            else
            {
                return(link);
            }
        }