示例#1
0
        public void GetPath()
        {
            HtmlPath path = HtmlPath.Parse("/BODY[0]/DIV[5]/DIV[0]/DIV[1]/TABLE[7]/TBODY[0]/TR[6]/TD[1]");

            var e = myDocument.GetElementByPath(path);

            Assert.AreEqual(path.ToString(), e.GetPath().ToString());
        }
示例#2
0
        public void TablePath()
        {
            HtmlPath p = new HtmlPath();

            p.Elements.Add(new HtmlPathElement("table", 1));

            Assert.AreEqual(1, p.Elements.Count);
            Assert.IsFalse(p.PointsToTableCell);
            Assert.IsTrue(p.PointsToTable);
            Assert.AreEqual("TABLE", p.Last.TagName);
            Assert.AreEqual("/TABLE[1]", p.ToString());
        }
示例#3
0
        public void SimplePath()
        {
            HtmlPath p = new HtmlPath();

            p.Elements.Add(new HtmlPathElement("body", 0));
            p.Elements.Add(new HtmlPathElement("h3", 0));

            Assert.AreEqual(2, p.Elements.Count);
            Assert.IsFalse(p.PointsToTableCell);
            Assert.IsFalse(p.PointsToTable);
            Assert.AreEqual("H3", p.Last.TagName);
            Assert.AreEqual("/BODY[0]/H3[0]", p.ToString());
        }
示例#4
0
        public void TableCellPath()
        {
            HtmlPath p = new HtmlPath();

            p.Elements.Add(new HtmlPathElement("table", 0));
            p.Elements.Add(new HtmlPathElement("tr", 2));
            p.Elements.Add(new HtmlPathElement("td", 4));

            Assert.AreEqual(3, p.Elements.Count);
            Assert.IsTrue(p.PointsToTableCell);
            Assert.IsFalse(p.PointsToTable);
            Assert.AreEqual("TD", p.Last.TagName);
            Assert.AreEqual("/TABLE[0]/TR[2]/TD[4]", p.ToString());
        }