Esempio n. 1
0
 public void SElementShouldHaveAttribute()
 {
     Given.OpenedPageWithBody("<h1 class='big-title'>Hello Babe!</h1>");
     Selene.S("h1").ShouldNot(Have.Attribute("class", "big title"));
     When.WithBody("<h1 class='big title'>Hello world!</h1>");
     Selene.S("h1").Should(Have.Attribute("class", "big title"));
 }
        public void SElementSearchWithCss()
        {
            // search using wrapped driver methods
            String      cssSelector = @"h1[name = ""greeting""]";
            IWebDriver  driver      = Selene.GetWebDriver();
            IWebElement element     = driver.FindElement(By.CssSelector(cssSelector));

            StringAssert.IsMatch("greeting", element.GetAttribute("name"));

            // search using NSelene methods
            Selene.S(With.Css(cssSelector), driver).Should(Be.InDom);
            Selene.S(With.Css(cssSelector)).Should(Have.Attribute("name", element.GetAttribute("name")));

            // compare old style and new style search results
            StringAssert.IsMatch(Selene.S(cssSelector).GetAttribute("outerHTML"), Selene.S(With.Css(cssSelector)).GetAttribute("outerHTML"));
        }