示例#1
0
        public void FindByCssPathNoElement()
        {
            PropertiesCollection.driver.Navigate().GoToUrl("http://testing.todorvachev.com");

            HomePageObject            homePage            = new HomePageObject();
            SelectorsPageObject       selectorPage        = new SelectorsPageObject();
            CssPathSelectorPageObject cssPathSelectorPage = new CssPathSelectorPageObject();

            selectorPage        = homePage.ClickSelectorPage();
            cssPathSelectorPage = selectorPage.ClickCssPathSelectorPage();

            IWebElement element;

            try
            {
                element = PropertiesCollection.driver.FindElement(By.CssSelector("#post-108 > div > fig img"));

                if (element.Displayed)
                {
                    Assert.Pass();
                }
                else
                {
                    Assert.Fail();
                }
            }
            catch (NoSuchElementException)
            {
            }
        }
示例#2
0
        public void FindByCssPath()
        {
            PropertiesCollection.driver.Navigate().GoToUrl("http://testing.todorvachev.com");

            HomePageObject            homePage            = new HomePageObject();
            SelectorsPageObject       selectorPage        = new SelectorsPageObject();
            CssPathSelectorPageObject cssPathSelectorPage = new CssPathSelectorPageObject();

            selectorPage        = homePage.ClickSelectorPage();
            cssPathSelectorPage = selectorPage.ClickCssPathSelectorPage();

            if (cssPathSelectorPage.imgCssSelector.Displayed)
            {
                Assert.Pass();
            }
            else
            {
                Assert.Fail();
            }
        }