public void FindingControls()
        {
            // Find the first table on the page.
            HtmlTable outertable = Find.ByTagIndex <HtmlTable>("table", 0);

            Assert.IsTrue(outertable.Rows.Count == 3);

            // Find the first table inside the outer table
            //
            // Note: HtmlContainerControls have a Find object
            //       associated with them that scopes all the Find.Byxx searches
            //       to elements contained within them only.
            //       So even if you have multiple controls with similar contained
            //       elements, this will help avoid any conflicts.
            //       Also, note how we are referencing the innertable using index 0
            //       since it is the first table inside our outer table.
            //
            HtmlTable innerTable = outertable.Find.ByTagIndex <HtmlTable>("table", 0);

            // Special Find for tables.
            HtmlTableCell cell = innerTable.Find.TableCell("TD21");

            Assert.IsTrue(cell.TextContent.Equals("TD21"));

            // Find all HtmlInputImage controls with 'src' containing partial value 'logo'
            IList <HtmlInputImage> imgCtrls = Find.AllByAttributes <HtmlInputImage>("src=~logo");

            // There should only be one HtmlInputText control. All controls
            // That match the attribute list but fail validation by the HtmlInputText control
            // will be ignored.
            Assert.AreEqual(1, imgCtrls.Count);

            // Find the <div> section containing the Eastern US Division sales report
            HtmlDiv EasternUSDivision = Find.ByContent <HtmlDiv>("Eastern US Division", FindContentType.TextContent);

            Assert.IsNotNull(EasternUSDivision);

            // Traverse the control tree upwards too. You can easily
            // Find the container control of a certain type from its children.

            // Find the owner form of the submit button
            HtmlInputSubmit submitButton = Find.ById <HtmlInputSubmit>("submit");
            HtmlForm        form         = submitButton.Parent <HtmlForm>();

            // Get the name of the frame targeted by the form
            string myFrame = form.Target;

            Assert.AreEqual("_self", myFrame);

            // Find the 3rd text input field on the form. Index is 0 based, so we enter 2 to mean the 3rd one.
            HtmlInputText input = form.Find.ByTagIndex <HtmlInputText>("input", 2);

            Assert.IsNotNull(input);

            // Find the table that contains this cell.
            HtmlTable table = cell.Parent <HtmlTable>();

            Assert.IsTrue(table.ID.Equals(innerTable.ID));

            // Find the parent table of this inner table.
            HtmlTable table2 = table.Parent <HtmlTable>();

            Assert.IsTrue(table2.ID.Equals(outertable.ID));

            // Find the form this table is contained in.
            HtmlForm form1 = table2.Parent <HtmlForm>();

            Assert.IsTrue(form1.ID.Equals("form1"));

            // Note: if Find.IgnoreFindAllControlMismatch is set to false, the
            // Find.Allxx<>() method will throw when encounters a control that matches the search
            // criteria but fails to be the desired HTMLControl.

            // TIP: The above example is to show the functionality of the Find.Byxx<> function.
            // It is not recommended to use loose attribute finds like the one above since it will
            // match many controls on the page that will be ignored. The better the find constraints
            // are the more performant the search is.
            // For example, the above Find can be enhanced by doing ("id=~1","type=text")
        }