public void HtmlAssertTests()
        {
            // Attribute checks
            HtmlSpan span = Find.ById <HtmlSpan>("Warning");

            span.AssertAttribute().Exists("style");
            span.AssertAttribute().Value("style", ArtOfTest.Common.StringCompareType.Contains, "color");

            // Checkbox checks
            HtmlInputCheckBox cbx = Find.ById <HtmlInputCheckBox>("Checkbox1");

            cbx.AssertCheck().IsTrue();
            cbx.Click();
            cbx.AssertCheck().IsFalse();

            // Content checks
            span.AssertContent().InnerText(StringCompareType.Contains, "Warning");
            span.AssertContent().InnerText(StringCompareType.NotContain, "Error");
            span.AssertContent().StartTagContent(StringCompareType.StartsWith, "<span");

            HtmlDiv topdiv = Find.ById <HtmlDiv>("topmost");

            topdiv.AssertContent().TextContent(StringCompareType.Exact, "Top most text");
            topdiv.AssertContent().InnerText(StringCompareType.Exact,
                                             "Top most textMiddle level textInnermost text");
            topdiv.AssertContent().OuterMarkup(StringCompareType.EndsWith,
                                               "Innermost text</DIV></DIV></DIV>");
            topdiv.AssertContent().InnerMarkup(StringCompareType.EndsWith,
                                               "Innermost text</DIV></DIV>");

            // Select checks
            HtmlSelect select = Find.ById <HtmlSelect>("color_product");

            select.AssertSelect().ItemsCountIs(NumberCompareType.Equals, 5);
            select.AssertSelect().SelectedIndex(NumberCompareType.Equals, 0);
            select.AssertSelect().SelectedText(StringCompareType.Exact, "Color : Blue");
            select.AssertSelect().SelectedValue(StringCompareType.Exact, "Blue");

            select.SelectByIndex(3);
            select.AssertSelect().SelectedIndex(NumberCompareType.Equals, 3);
            select.AssertSelect().SelectedText(StringCompareType.Exact, "Color : Orange");
            select.AssertSelect().SelectedValue(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,
                                                  StringCompareType.Exact);

            // Table checks
            HtmlTable table = Find.ById <HtmlTable>("outertable1");

            table.AssertTable().ColumnCount(NumberCompareType.Equals, 3);
            table.AssertTable().ColumnRange(NumberRangeCompareType.InRange, 2, 5);
            table.AssertTable().RowCount(NumberCompareType.Equals, 3);
            table.AssertTable().RowRange(NumberRangeCompareType.OutsideRange, 1, 2);
            table.AssertTable().Contains(StringCompareType.Contains, "TD5");
            table.AssertTable().Contains(StringCompareType.NotContain, "TD37");
        }
        public void CommonHtmlControlMethodsProperties()
        {
            // All controls have a Click/MouseClick. The .Click invokes a click from the DOM,
            // the MouseClick(), moves the mouse to the controls and clicks it.

            //
            // CLICKING
            //
            Find.ById <HtmlInputButton>("button1").Click();
            ActiveBrowser.Refresh();
            Find.ById <HtmlInputButton>("button1").MouseClick();

            // You can capture any element on the page using the .Capture()
            Find.ById <HtmlInputImage>("image1").Capture("myfile"); // Will be stored to the Log.LogLocation

            //
            // CHECKING
            //
            // Check a checkbox and invoke the onclick event.
            HtmlInputCheckBox ck = Find.ById <HtmlInputCheckBox>("checkbox1");

            if (ActiveBrowser.BrowserType == BrowserType.Safari)
            {
                // Unfortunately the way Safari behaves is different then the other browsers.
                ck.Check(true, false);
            }
            else
            {
                ck.Check(true, true);
            }

            // Query the checked state
            Assert.IsTrue(ck.Checked);
            // You can also simply set the value without invoking the clicked event.
            ck.Checked = false;
            Assert.IsFalse(ck.Checked);

            // Get whether a checkbox is enabled or disabled.
            HtmlInputCheckBox cks = Find.ById <HtmlInputCheckBox>("checkbox1");
            bool disabled         = cks.GetValue <bool>("disabled");

            // Disable it
            cks.SetValue <string>("disabled", "true");
            Assert.IsTrue(cks.GetValue <bool>("disabled"));

            // Is it visible
            Assert.IsTrue(cks.IsVisible());

            // When the contents of a div element are larger than the declared
            // width or height of element it automatically adds scroll bars.
            // When that happens we can scroll the contents of the div element.
            // The value represents the offset in pixels to scroll the contents.
            HtmlDiv infoDiv = Find.ById <HtmlDiv>("AutoInfo");

            infoDiv.ScrollTop  = 50;
            infoDiv.ScrollLeft = 75;

            //
            // SELECTING
            //
            HtmlSelect select = Find.ById <HtmlSelect>("color_product");

            Assert.IsTrue(select.SelectedOption.Value.Equals("Blue"));
            Assert.IsTrue(select.SelectedOption.Text.Equals("Color : Blue"));

            select.SelectByIndex(1);
            Assert.IsTrue(select.SelectedOption.Text.Equals("Color : Green"));

            //
            // SET TEXT
            //
            Find.ById <HtmlTextArea>("textarea1").Text = "NEW TEXT";

            // Access common methods
            HtmlAnchor link = Find.ByAttributes <HtmlAnchor>("href=~google");

            Assert.IsTrue(link.Attributes.Count == 3);
            Assert.IsTrue(link.BaseElement.TextContent.Trim().Equals("Link"));

            // Invoke any events on the control
            link.InvokeEvent(ScriptEventType.OnFocus);
        }