Пример #1
0
        static private int GetElmentCount(ElementCollection elements)
        {
            int count = 0;

            AutoRobo.Core.App.Wait(() =>
            {
                try
                {
                    count = elements.Count;
                    return(true);
                }
                catch
                {
                    return(false);
                }
            });
            return(count);
        }
Пример #2
0
        static public ElementCollection GetElementsByTag(this IElementContainer container, string tagName, Constraint constraint)
        {
            string[] parameters = null;
            if (tagName.ToLower() == "input")
            {
                parameters = new string[] { "checkbox", "text", "hidden", "radio", "password", "button", "submit", "reset", "file", "image" };
            }

            ElementCollection elements = null;

            elements = container.ElementsWithTag(tagName, parameters);
            if (constraint != null)
            {
                elements = elements.Filter(constraint);
            }
            if (!elements.Any())
            {
                Browser browser = container as Browser;
                if (browser != null)
                {
                    foreach (var frame in browser.Frames)
                    {
                        elements = frame.ElementsWithTag(tagName, parameters);
                        if (constraint != null)
                        {
                            elements = elements.Filter(constraint);
                        }
                        if (elements.Any())
                        {
                            break;
                        }
                    }
                }
            }

            return(elements);
        }