// Attribute checks
HtmlSpan span = Find.ById<HtmlSpan>("Warning");
span.AssertAttribute().Exists("style");
span.AssertAttribute().Value("style", ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "color");
// Checkbox checks
HtmlInputCheckBox cbx = Find.ById<HtmlInputCheckBox>("Checkbox1");
cbx.AssertCheck().IsTrue();
cbx.Click();
cbx.AssertCheck().IsFalse();
// Content checks
span.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "Warning");
span.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "Error");
span.AssertContent().StartTagContent(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.StartsWith, "<span");
HtmlDiv topdiv = Find.ById<HtmlDiv>("topmost");
topdiv.AssertContent().TextContent(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most text");
topdiv.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most textMiddle level textInnermost text");
topdiv.AssertContent().OuterMarkup(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "<DIV id=topmost>Top most text<DIV id=middle>Middle level text<DIV id=innermost>Innermost text</DIV></DIV></DIV>");
topdiv.AssertContent().InnerMarkup(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most text<DIV id=middle>Middle level text<DIV id=innermost>Innermost text</DIV></DIV>");
// Select checks
HtmlSelect select = Find.ById<HtmlSelect>("color_product");
select.AssertSelect().ItemsCountIs(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 5);
select.AssertSelect().SelectedIndex(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 0);
select.AssertSelect().SelectedText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Color : Blue");
select.AssertSelect().SelectedValue(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Blue");
select.SelectByIndex(3);
select.AssertSelect().SelectedIndex(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3);
select.AssertSelect().SelectedText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Color : Orange");
select.AssertSelect().SelectedValue(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Orange");
select.AssertSelect().TextExists("Color : Black");
select.AssertSelect().TextExistsNot("Color : Magenta");
select.AssertSelect().ValueExists("Black");
select.AssertSelect().ValueExistsNot("Magenta");
// Style checks
NameValueCollection styles = span.Styles;
span.AssertStyle().Font(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleFont.Style, "italic");
span.AssertStyle().Text(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleText.TextAlign, "right");
span.AssertStyle().ColorAndBackground(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleColorAndBackground.Color, "red",
ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleType.Computed,
ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact);
// Table checks
HtmlTable table = Find.ById<HtmlTable>("outertable1");
table.AssertTable().ColumnCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3);
table.AssertTable().ColumnRange(ArtOfTest.Common.NumberRangeCompareType.InRange, 2, 5);
table.AssertTable().RowCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3);
table.AssertTable().RowRange(ArtOfTest.Common.NumberRangeCompareType.OutsideRange, 1, 2);
table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "TD5");
table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "TD37");
' Attribute checks
Dim span As HtmlSpan = Find.ById(Of HtmlSpan)("Warning")
span.AssertAttribute().Exists("style")
span.AssertAttribute().Value("style", ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "color")
' Checkbox checks
Dim cbx As HtmlInputCheckBox = Find.ById(Of HtmlInputCheckBox)("Checkbox1")
cbx.AssertCheck().IsTrue()
cbx.Click()
cbx.AssertCheck().IsFalse()
' Content checks
span.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "Warning")
span.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "Error")
span.AssertContent().StartTagContent(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.StartsWith, "<span")
Dim topdiv As HtmlDiv = Find.ById(Of HtmlDiv)("topmost")
topdiv.AssertContent().TextContent(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most text")
topdiv.AssertContent().InnerText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most textMiddle level textInnermost text")
topdiv.AssertContent().OuterMarkup(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "<DIV id=topmost>Top most text<DIV id=middle>Middle level text<DIV id=innermost>Innermost text</DIV></DIV></DIV>")
topdiv.AssertContent().InnerMarkup(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Top most text<DIV id=middle>Middle level text<DIV id=innermost>Innermost text</DIV></DIV>")
' Select checks
Dim [select] As HtmlSelect = Find.ById(Of HtmlSelect)("color_product")
[select].AssertSelect().ItemsCountIs(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 5)
[select].AssertSelect().SelectedIndex(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 0)
[select].AssertSelect().SelectedText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Color : Blue")
[select].AssertSelect().SelectedValue(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Blue")
[select].SelectByIndex(3)
[select].AssertSelect().SelectedIndex(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3)
[select].AssertSelect().SelectedText(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Color : Orange")
[select].AssertSelect().SelectedValue(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact, "Orange")
[select].AssertSelect().TextExists("Color : Black")
[select].AssertSelect().TextExistsNot("Color : Magenta")
[select].AssertSelect().ValueExists("Black")
[select].AssertSelect().ValueExistsNot("Magenta")
' Style checks
Dim styles As NameValueCollection = span.Styles
span.AssertStyle().Font(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleFont.Style, "italic")
span.AssertStyle().Text(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleText.TextAlign, "right")
span.AssertStyle().ColorAndBackground(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleColorAndBackground.Color, "red", ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.HtmlStyleType.Computed, ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Exact)
' Table checks
Dim table As HtmlTable = Find.ById(Of HtmlTable)("outertable1")
table.AssertTable().ColumnCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3)
table.AssertTable().ColumnRange(ArtOfTest.Common.NumberRangeCompareType.InRange, 2, 5)
table.AssertTable().RowCount(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.NumberCompareType.Equals, 3)
table.AssertTable().RowRange(ArtOfTest.Common.NumberRangeCompareType.OutsideRange, 1, 2)
table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.Contains, "TD5")
table.AssertTable().Contains(ArtOfTest.WebAii.Controls.HtmlControls.HtmlAsserts.StringCompareType.NotContain, "TD37")
There are many other possible assert verification combinations built into the framework that you can take advantage of. The above examples are just a small subset of what is possible to help you get started implementing them in your code and crafting the kinds of verification you need for your particular website. Consult the API reference manual to learn about the other combinations.