public void Should_return_no_elements_when_theres_no_match_with_tagname() { // GIVEN var element1 = CreateNativeElement("id1", "div"); var element2 = CreateNativeElement("id2", "a"); var element3 = CreateNativeElement("id3", "li"); IList <IWebElement> elements = new List <IWebElement> { element1, element2, element3 }; var collection = new WebDriverNativeElementCollectionSpecial(() => elements); // WHEN var result = collection.GetElementsByTag("input"); // THEN Assert.That(result.Count(), Is.EqualTo(0), "Unexpected number of elements"); }
public void Should_return_elements_with_specific_tagname() { // GIVEN var element1 = CreateNativeElement("id1", "div"); var element2 = CreateNativeElement("id2", "a"); var element3 = CreateNativeElement("id1", "div"); IList<IWebElement> elements = new List<IWebElement> { element1, element2, element3 }; var collection = new WebDriverNativeElementCollectionSpecial(() => elements); // WHEN var result = collection.GetElementsByTag("div"); // THEN Assert.That(result.Count(), Is.EqualTo(2), "Unexpected number of elements"); var id1Count = result.Count(element => element.TagName == "div"); Assert.That(id1Count, Is.EqualTo(2), "Unexpected number of div elements"); }
public void Should_return_elements_with_specific_tagname() { // GIVEN var element1 = CreateNativeElement("id1", "div"); var element2 = CreateNativeElement("id2", "a"); var element3 = CreateNativeElement("id1", "div"); IList <IWebElement> elements = new List <IWebElement> { element1, element2, element3 }; var collection = new WebDriverNativeElementCollectionSpecial(() => elements); // WHEN var result = collection.GetElementsByTag("div"); // THEN Assert.That(result.Count(), Is.EqualTo(2), "Unexpected number of elements"); var id1Count = result.Count(element => element.TagName == "div"); Assert.That(id1Count, Is.EqualTo(2), "Unexpected number of div elements"); }
public void Should_return_no_elements_when_theres_no_match_with_tagname() { // GIVEN var element1 = CreateNativeElement("id1", "div"); var element2 = CreateNativeElement("id2", "a"); var element3 = CreateNativeElement("id3", "li"); IList<IWebElement> elements = new List<IWebElement> { element1, element2, element3 }; var collection = new WebDriverNativeElementCollectionSpecial(() => elements); // WHEN var result = collection.GetElementsByTag("input"); // THEN Assert.That(result.Count(), Is.EqualTo(0), "Unexpected number of elements"); }