예제 #1
0
        public static ElementLocator FromElement(Element element)
        {
            var locator = new ElementLocator
            {
                Steps = new List <int>()
            };

            Build(locator, element);
            return(locator);
        }
예제 #2
0
파일: SetIdDelta.cs 프로젝트: rChavz/lara
        public static void Enqueue(Element element, string?newValue)
        {
            if (!element.TryGetQueue(out var document))
            {
                return;
            }
            var locator = ElementLocator.FromElement(element);

            document.Enqueue(new SetIdDelta
            {
                Locator = locator,
                NewId   = newValue
            });
        }
예제 #3
0
 private static void Build(ElementLocator locator, Element element)
 {
     if (string.IsNullOrEmpty(element.Id))
     {
         var parent = element.ParentElement;
         if (parent == null)
         {
             return;
         }
         var index = parent.GetChildElementPosition(element);
         locator.GetSteps().Add(index);
         Build(locator, parent);
     }
     else
     {
         locator.StartingId = element.Id;
     }
 }