Skip to content

Instantly share code, notes, and snippets.

@iwx1
Created April 22, 2014 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwx1/11183789 to your computer and use it in GitHub Desktop.
Save iwx1/11183789 to your computer and use it in GitHub Desktop.
WatiN Extensions for h1 h2 h3 th
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