Created
April 22, 2014 15:33
-
-
Save iwx1/11183789 to your computer and use it in GitHub Desktop.
WatiN Extensions for h1 h2 h3 th
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace WatiN.Core | |
{ | |
using WatiN.Core.Constraints; | |
using WatiN.Core.Native; | |
public static class DocumentExtensions | |
{ | |
public static H1 H1<TDoc>(this TDoc doc, string text) | |
where TDoc : Document | |
{ | |
ElementFactory.RegisterElementType(typeof(H1)); | |
return doc.ElementOfType<H1>(Find.ByText(text)); | |
} | |
public static H2 H2<TDoc>(this TDoc doc, string text) | |
where TDoc : Document | |
{ | |
ElementFactory.RegisterElementType(typeof(H2)); | |
return doc.ElementOfType<H2>(Find.ByText(text)); | |
} | |
public static H3 H3<TDoc>(this TDoc doc, string text) | |
where TDoc : Document | |
{ | |
ElementFactory.RegisterElementType(typeof(H3)); | |
return doc.ElementOfType<H3>(Find.ByText(text)); | |
} | |
public static ElementCollection<H3> H3Collection<TDoc>(this TDoc doc) | |
where TDoc : Document | |
{ | |
ElementFactory.RegisterElementType(typeof(H3)); | |
return doc.ElementsOfType<H3>(); | |
} | |
public static TableHeaderCell TableHeaderCell<TTable>(this TTable table, Constraint findBy) | |
where TTable : Table | |
{ | |
ElementFactory.RegisterElementType(typeof(TableHeaderCell)); | |
return table.TableHeaderCell(findBy); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment