Example #1
0
        public void LocateElementWithId()
        {
            var x       = Element.Create("span", "x");
            var locator = ElementLocator.FromElement(x);

            Assert.Equal(x.Id, locator.StartingId);
            Assert.NotNull(locator.Steps);
            Assert.Empty(locator.Steps);
        }
Example #2
0
        public void LocateWithSteps()
        {
            var x0 = Element.Create("div", "x0");

            x0.AppendChild(Element.Create("div"));
            x0.AppendChild(Element.Create("div"));
            x0.AppendChild(Element.Create("div"));
            var a = Element.Create("div");

            x0.AppendChild(a);
            var b = Element.Create("div");

            a.AppendChild(b);
            var locator = ElementLocator.FromElement(b);
            var steps   = locator.Steps;

            Assert.Equal(b.ParentElement !.Id, locator.StartingId);
            Assert.Single(steps);
            Assert.Equal(0, steps ![0]);