How to find an item in Watin by its tag name?

How to find a specific item or list of items using their TagName using Watin?

+7
watin
source share
3 answers

As of WatiN 2.0 beta 1, this has changed to:

ie.ElementWithTag("h1", constraint); 

Using Find.XXX methods creates restrictions.

Here is an example:

 ie.ElementWithTag("h1", Find.ByClass("blue"); 
+10
source share

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

 ie.Element("h1", Find.ByIndex(0)) 
+1
source share

this is what worked for me:

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

0
source share

All Articles