tags:

views:

1211

answers:

3

How to find a specific element, or a list of elements by using their TagName using Watin?

+2  A: 

For example, to find the first <h1> on a page, use:

ie.Element("h1", Find.ByIndex(0))
Lars Thorup
and how to find last? :)
Arnis L.
+1  A: 

As of WatiN 2.0 beta 1 this has changed to:

ie.ElementWithTag("h1", constraint);
Jeroen van Menen
Could you expand this example to show what is in the constraint object?
Andrew M
A: 

this is what worked for me:

var element = ie.Element(x => x.Text == "[innerText]" && x.TagName == "[tagname]");

mahmud khaled