コード例 #1
0
        public void FindAllByxx()
        {
            //
            // The Find.AllByxx methods allow you to find multiple elements on the page using certain criteria
            //

            // Example 1: Get all table elements on the page.
            //
            IList <Element> tables = Find.AllByTagName("table");

            Assert.IsTrue(tables.Count == 2);

            // Example 2: Get all table cells that contain a 'yes'
            //
            IList <Element> cells = Find.AllByContent("yes");

            Assert.IsTrue(cells.Count == 5);

            // Example 3: Find all table rows that contain a scope=row attribute
            IList <Element> rows = Find.AllByAttributes("scope=row"); // partial compare (~) is also supported

            Assert.IsTrue(rows.Count == 3);

            // Example 4: Same as #1 above but using an XPath
            tables = Find.AllByXPath("/descendant::table");
            Assert.IsTrue(tables.Count == 2);
        }