public void SCollectionShouldHaveCountAtLeastAndCount() { Given.OpenedEmptyPage(); SS("li").ShouldNot(Have.Count(2)); When.WithBody("<ul>Hello to:<li>Dear Bob</li><li>Lovely Kate</li></ul>"); SS("li").ShouldNot(Have.CountAtLeast(3)); SS("li").Should(Have.Count(2)); SS("li").Should(Have.CountAtLeast(1)); }
public void SeleneCollectionSearchWithXPath() { // search using wrapped driver methods IWebDriver driver = Selene.GetWebDriver(); // confirm XPath is valid String xpath = "//ul/li"; ReadOnlyCollection <IWebElement> webElements = driver.FindElements(By.XPath(xpath)); Assert.NotNull(webElements); Assert.Greater(webElements.Count, 0); StringAssert.IsMatch("li", webElements[0].TagName); // search thru NSelene SeleneCollection seleWebElements = null; By seleneLocator = With.XPath(xpath); seleWebElements = Selene.SS(seleneLocator); Assert.NotNull(seleWebElements); Assert.AreEqual(seleWebElements.Count, webElements.Count); StringAssert.IsMatch("li", seleWebElements[0].TagName); // exercise NSelene extension methods Selene.SS(seleneLocator).Should(Have.CountAtLeast(1)); Selene.SS(seleneLocator).Should(Have.ExactTexts("Dear Bob", "Dear Frank", "Lovely Kate")); }
public Results ShouldHaveSizeAtLeast(int number) { list.Should(Have.CountAtLeast(number)); return(this); }