本文整理匯總了C#中WatiN.Core.IE.ElementsWithTag方法的典型用法代碼示例。如果您正苦於以下問題:C# IE.ElementsWithTag方法的具體用法?C# IE.ElementsWithTag怎麽用?C# IE.ElementsWithTag使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WatiN.Core.IE
的用法示例。
在下文中一共展示了IE.ElementsWithTag方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Should_add_three_visits
public void Should_add_three_visits()
{
new DatabaseTester().Clean();
var url = "http://localhost:1234/";
using (var ie = new IE(url))
{
ie.Button("submit").Click();
Thread.Sleep(2000);
ie.Button("submit").Click();
Thread.Sleep(2000);
ie.Button("submit").Click();
Thread.Sleep(2000);
ie.ElementsWithTag("hr").Count.ShouldEqual(3);
}
}
示例2: ParentShouldReturnAnInstanceOfTypeListItemWhenRegisteredWithElementFactory
public void ParentShouldReturnAnInstanceOfTypeListItemWhenRegisteredWithElementFactory()
{
// GIVEN searching for WatiN on Google
ElementFactory.RegisterElementType(typeof(ListItem));
using (var ie = new IE("www.google.com"))
{
ie.TextField(Find.ByName("q")).TypeText("WatiN");
ie.Button(Find.ByName("btnG")).Click();
// Get the first li item on the page
var firstListItem = ie.ElementsWithTag("li")[0];
// get its first child (assuming it has a child)
var firstChild = ((IElementContainer)firstListItem).Elements[0];
// WHEN getting the parent of the child we should get the listitem again
var parentListItem = firstChild.Parent;
// THEN the returned item should be typed cause ElementFactory knows about ListItem
Assert.IsInstanceOfType(parentListItem, typeof(ListItem));
}
}