コード例 #1
1
 public ViewTree(IUIAutomationElement element, IUIAutomation automation)
 {
     this.root = new TreeNode(element);
     this.root.parent = null;
     IUIAutomationElementArray array = element.FindAll(TreeScope.TreeScope_Children, automation.CreateTrueCondition());
     if (0 == array.Length)
     {
         this.root.children = null;
         this.root.isLeaf = true;
     }
     else
     {
         for (int i = 0; i < array.Length; i++)
         {
             IUIAutomationElement e = array.GetElement(i);
             TreeNode n = new TreeNode(e);
             this.root.children.Add(n);
         }
     }
 }
コード例 #2
0
ファイル: ClickDetector.cs プロジェクト: p3NTech/SmartClicker
        // Uses Windows UI Automation API to determine if we should click and Drag in context Mode
        private void uiAutomationCheck(Point p)
        {
            tagPOINT reference = new tagPOINT();

            reference.x = p.X;
            reference.y = p.Y;

            if (this.status.getCurrentMode() != ProgramMode.clickAndDrag)
            {
                try
                {
                    IUIAutomationElement focus = this.automator.ElementFromPoint(reference);

                    // Useful for debugging API support
                    System.Diagnostics.Debug.Print(focus.CurrentControlType.ToString());
                    System.Diagnostics.Debug.Print("localized:" + focus.CurrentLocalizedControlType);

                    if ((focus.CurrentControlType == 50037 && this.parameters.contextValues.supportTitleBars) ||
                        (focus.CurrentControlType == 50027 && this.parameters.contextValues.supportScrollBars) ||
                        (focus.CurrentControlType == 50018 && this.parameters.contextValues.supportTabs))
                    {
                        this.status.setCurrentMode(ProgramMode.clickAndDrag);
                    }
                }
                catch (COMException e)
                {
                    // No element given, give up
                }
            }
        }
コード例 #3
0
        public IUIAutomationElement GetScrollingContainerElement(IUIAutomationElement rootElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "wsFrame");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_DocumentControlTypeId);
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "document");

            IUIAutomationCondition conditions   = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement   frameElement = rootElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            conditionArray    = new IUIAutomationCondition[3];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "mainContent");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_ListControlTypeId);

            conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement contentElement = frameElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            conditionArray    = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Scrolling Container");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_GroupControlTypeId);
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "group");

            conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement scrollingContainerElement = contentElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            return(scrollingContainerElement);
        }
コード例 #4
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // RegisterStructureChangeListener()
        //
        // Add a UIA event handler to react to structure change events sent from the browser window.
        //
        // Runs on the background thread.
        //
        /////////////////////////////////////////////////////////////////////////////////////////////////
        void RegisterStructureChangeListener()
        {
            // This sample assumes we know which window we want to gets events from.

            // *** Note: We must get a pointer to the element we're interested in, in this thread. Do
            // not have the UI thread get the element and supply it through to the background thread.

            IntPtr hwnd = Win32.FindWindow(strBrowserWindowClass, null);

            if (hwnd != IntPtr.Zero)
            {
                _elementBrowser = _automation.ElementFromHandle(hwnd);
                if (_elementBrowser != null)
                {
                    // In general it is not the IEFrame element itself which throws the structure change
                    // events which we will receive in the handler, but rather various decendants elements.
                    // It is these descendants which are the "senders" in the event handler later.

                    // AddStructureChangedEventHandler() can take a cache request as other UIA methods do.
                    // So if an event handler wanted to retrieve properties from the event sender without
                    // having to incur the time cost for a cross-proc call, it would use a cache request
                    // here. (For this sample, the event handler doesn't need that.)

                    // Other types of UIA event handler can be set up with the following calls:
                    //   AddFocusChangeEventHandler()
                    //   AddAutomationEventHandler()
                    //   AddPropertyChangeEventHandler() - note that some providers might not raise all
                    //                                     the expected propety change events.

                    _automation.AddStructureChangedEventHandler(_elementBrowser, TreeScope.TreeScope_Descendants, null, this);

                    _fAddedEventHandler = true;
                }
            }
        }
コード例 #5
0
        /// <summary>
        /// Get Property value safely
        /// </summary>
        /// <param name="element"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        private static dynamic GetPropertyValue(IUIAutomationElement element, int id)
        {
            if (element == null)
            {
                throw new ArgumentNullException(nameof(element));
            }

            dynamic value = null;

            try
            {
                value = element.GetCurrentPropertyValue(id);
                if (id == PropertyType.UIA_LabeledByPropertyId && value != null)
                {
                    value = GetHeaderOfLabelBy(value);
                }
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
            {
                e.ReportException();
                value = null;
            }
#pragma warning restore CA1031 // Do not catch general exception types

            return(value);
        }
コード例 #6
0
        internal static IUIAutomationElement GetCurrentParent(this IUIAutomationElement element)
        {
            var automation = new CUIAutomationClass();
            var walker     = automation.CreateTreeWalker(automation.RawViewCondition);

            return(walker.GetParentElement(element));
        }
コード例 #7
0
        public void MyTestInitialize()
        {
            // Create the factory and register schemas
            _nFactory = new CUIAutomationClass();

            // Start the app
            var curDir = Environment.CurrentDirectory;

            _app = new TargetApp(curDir + "\\WpfAppWithAdvTextControl.exe");
            _app.Start();

            // Find the main control
            var appElement = _nFactory.ElementFromHandle(_app.MainWindow);

            var advTestBoxCondition = _nFactory.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "advTextBox1");

            _nAdvancedTextBoxElement = appElement.FindFirst(NTreeScope.TreeScope_Children, advTestBoxCondition);
            Assert.IsNotNull(_nAdvancedTextBoxElement);

            var testControlCondition = _nFactory.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "testControl");

            _nTestControlElement = appElement.FindFirst(NTreeScope.TreeScope_Children, testControlCondition);
            Assert.IsNotNull(_nTestControlElement);

            var window = AutomationElement.RootElement.FindFirst(WTreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "MainWindow"));

            _wAdvancedTextBoxElement = window.FindFirst(WTreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "advTextBox1"));
            _wTestControlElement     = window.FindFirst(WTreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "testControl"));
        }
コード例 #8
0
        public void MyTestInitialize()
        {
            // Create the factory and register schemas
            _nFactory = new CUIAutomationClass();

            // Start the app
            var curDir = Environment.CurrentDirectory;
            _app = new TargetApp(curDir + "\\WpfAppWithAdvTextControl.exe");
            _app.Start();

            // Find the main control
            var appElement = _nFactory.ElementFromHandle(_app.MainWindow);

            var advTestBoxCondition = _nFactory.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "advTextBox1");
            _nAdvancedTextBoxElement = appElement.FindFirst(NTreeScope.TreeScope_Children, advTestBoxCondition);
            Assert.IsNotNull(_nAdvancedTextBoxElement);

            var testControlCondition = _nFactory.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "testControl");
            _nTestControlElement = appElement.FindFirst(NTreeScope.TreeScope_Children, testControlCondition);
            Assert.IsNotNull(_nTestControlElement);

            var window = AutomationElement.RootElement.FindFirst(WTreeScope.Children, new PropertyCondition(AutomationElement.NameProperty, "MainWindow"));
            _wAdvancedTextBoxElement = window.FindFirst(WTreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "advTextBox1"));
            _wTestControlElement = window.FindFirst(WTreeScope.Descendants, new PropertyCondition(AutomationElement.AutomationIdProperty, "testControl"));
        }
コード例 #9
0
#pragma warning disable CA1725 // Parameter names should match base declaration
        public void HandleTextEditTextChangedEvent(IUIAutomationElement sender, TextEditChangeType textEditChangeType, string[] eventStrings)
#pragma warning restore CA1725 // Parameter names should match base declaration
        {
#pragma warning disable CA2000 // Call IDisposable.Dispose()
            var m = EventMessage.GetInstance(this.EventId, sender);

            if (m != null)
            {
                m.Properties = new List <KeyValuePair <string, dynamic> >
                {
                    new KeyValuePair <string, dynamic>("TextEditChangeType", textEditChangeType.ToString()),
                };

                if (eventStrings != null)
                {
                    for (int i = 0; i < eventStrings.Length; i++)
                    {
                        m.Properties.Add(new KeyValuePair <string, dynamic>(Invariant($"[{i}]"), eventStrings.GetValue(i)));
                    }
                }

                this.ListenEventMessage(m);
            }
#pragma warning restore CA2000
        }
コード例 #10
0
ファイル: EdgeA11yTools.cs プロジェクト: stanleyhon/A11y
        /// <summary>
        /// Find all descendents of a given element, optionally searching with the given strategy
        /// </summary>
        /// <param name="element">The element whose descendents we need to find</param>
        /// <param name="searchStrategy">The strategy we should use to evaluate children</param>
        /// <returns>All elements that pass the searchStrategy</returns>
        public static List <IUIAutomationElement> GetAllDescendents(this IUIAutomationElement element, Func <IUIAutomationElement, bool> searchStrategy = null)
        {
            var toReturn = new List <IUIAutomationElement>();
            var walker   = new CUIAutomation8().RawViewWalker;

            var toSearch = new Queue <IUIAutomationElement>();//BFS

            toSearch.Enqueue(element);

            while (toSearch.Any())//beware infinite recursion. If this becomes a problem add a limit
            {
                var current = toSearch.Dequeue();
                for (var child = walker.GetFirstChildElement(current); child != null; child = walker.GetNextSiblingElement(child))
                {
                    toSearch.Enqueue(child);
                }

                if (searchStrategy == null || searchStrategy(current))
                {
                    toReturn.Add(current);
                }
            }

            return(toReturn);
        }
コード例 #11
0
        public static bool OpenBarMenu()
        {
            try
            {
                //197170
                var winBarUia = UiaHelper.GetUIAutomation().ElementFromHandle((IntPtr)197170);
                var elements  = winBarUia.FindAll(UIAutomationClient.TreeScope.TreeScope_Descendants, UiaHelper.GetUIAutomation().
                                                  CreateTrueCondition());
                IUIAutomationElement mation = null;
                for (var i = 0; i < elements.Length; i++)
                {
                    if (elements.GetElement(i).CurrentName == "增值税普通发票填开")
                    {
                        mation = elements.GetElement(i);
                    }
                    Console.WriteLine($"name:{elements.GetElement(i).CurrentName},handler:{elements.GetElement(i).CurrentNativeWindowHandle}");
                }
                var pt = (IUIAutomationInvokePattern)mation.GetCurrentPattern(UIA_PatternIds.UIA_InvokePatternId);

                Task.Factory.StartNew(() => { pt.Invoke(); });
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
            return(false);
        }
コード例 #12
0
        public static IUIAutomationElement FindDescendantByName(
            this IUIAutomationElement parent,
            string name
            )
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }

            var condition = Helper.Automation.CreatePropertyCondition(
                AutomationElementIdentifiers.NameProperty.Id,
                name
                );
            var child = Helper.Retry(
                () => parent.FindFirst(TreeScope.TreeScope_Descendants, condition),
                AutomationRetryDelay,
                retryCount: AutomationRetryCount
                );

            if (child == null)
            {
                throw new InvalidOperationException(
                          $"Could not find item with name '{name}' under '{parent.GetNameForExceptionMessage()}'."
                          );
            }

            return(child);
        }
コード例 #13
0
        private static void ThrowUnableToFindChildException(string path, IUIAutomationElement item)
        {
            // if not found, build a list of available children for debugging purposes
            var validChildren = new List <string>();

            try
            {
                var children = item.GetCachedChildren();
                for (var i = 0; i < children.Length; i++)
                {
                    validChildren.Add(SimpleControlTypeName(children.GetElement(i)));
                }
            }
            catch (InvalidOperationException)
            {
                // if the cached children can't be enumerated, don't blow up trying to display debug info
            }

            throw new InvalidOperationException(
                      string.Format(
                          "Unable to find a child named {0}.  Possible values: ({1}).",
                          path,
                          string.Join(", ", validChildren)
                          )
                      );
        }
コード例 #14
0
        /// <summary>
        /// Populate siblings
        /// </summary>
        /// <param name="parentNode"></param>
        /// <param name="poiNode"></param>
        /// <param name="startId"></param>
        private int PopulateSiblingTreeNodes(A11yElement parentNode, A11yElement poiNode)
        {
            int childId = 1;

            IUIAutomationTreeWalker walker = this.TreeWalker;
            IUIAutomationElement    child  = null;

            if ((IUIAutomationElement)parentNode.PlatformObject != null)
            {
                try
                {
                    child = walker.GetFirstChildElement((IUIAutomationElement)parentNode.PlatformObject);
                }
#pragma warning disable CA1031 // Do not catch general exception types
                catch (Exception ex)
                {
                    ex.ReportException();
                    child = null;
                    System.Diagnostics.Trace.WriteLine("Tree walker exception: " + ex);
                }
#pragma warning restore CA1031 // Do not catch general exception types

                while (child != null)
                {
#pragma warning disable CA2000 // Use recommended dispose patterns
                    var childNode = new DesktopElement(child, true, false);
#pragma warning restore CA2000 // Use recommended dispose patterns
                    childNode.PopulateMinimumPropertiesForSelection();

                    if (childNode.IsSameUIElement(poiNode) == false)
                    {
                        childNode.UniqueId       = childId++;
                        childNode.Parent         = parentNode;
                        childNode.TreeWalkerMode = this.TreeWalkerMode;
                        this.Items.Add(childNode);
                    }
                    else
                    {
                        childNode = poiNode as DesktopElement;
                    }

                    parentNode.Children.Add(childNode);

                    try
                    {
                        child = walker.GetNextSiblingElement(child);
                    }
#pragma warning disable CA1031 // Do not catch general exception types
                    catch (Exception ex)
                    {
                        ex.ReportException();
                        child = null;
                        System.Diagnostics.Trace.WriteLine("Tree walker exception: " + ex);
                    }
#pragma warning restore CA1031 // Do not catch general exception types
                }
            }

            return(childId);
        }
コード例 #15
0
 /// <summary>
 /// Private ctor to set common fields
 /// </summary>
 private EventListenerBase(IUIAutomationElement element, TreeScope scope, int eventId, HandleUIAutomationEventMessage peDelegate)
 {
     this.EventId            = eventId;
     this.Element            = element;
     this.ListenEventMessage = peDelegate;
     this.Scope = scope;
 }
コード例 #16
0
        public AutomationElement FindFirst(TreeScope scope, Condition condition)
        {
            Validate.ArgumentNotNull(parameter: condition, parameterName: nameof(condition));
            var firstBuildCache = IUIAutomationElement.FindFirstBuildCache(scope: UiaConvert.Convert(treeScope: scope), condition: condition.IUIAutomationCondition, cacheRequest: DefaultCacheRequest.IUIAutomationCacheRequest);

            return(firstBuildCache != null ? new AutomationElement(autoElement: firstBuildCache) : null);
        }
コード例 #17
0
        public object GetCachedPropertyValue(AutomationProperty property, bool ignoreDefaultValue)
        {
            Validate.ArgumentNotNull(parameter: property, parameterName: nameof(property));
            var cachedPropertyValueEx = IUIAutomationElement.GetCachedPropertyValueEx(propertyId: property.Id, ignoreDefaultValue: Convert.ToInt32(value: ignoreDefaultValue));

            return(UiaConvert.ConvertPropertyValue(property: property, propertyValueVariant: cachedPropertyValueEx));
        }
コード例 #18
0
 private AutomationElement(IUIAutomationElement elem)
 {
     pElement = elem;
     lock (typeof(AutomationElement)) {
         ++instances;
     }
 }
コード例 #19
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // InvokeLinkInternal()
        //
        // Invoke a hyperlink in the browser window.
        //
        // Runs on the background thread.
        //
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        private void InvokeLinkInternal(IUIAutomationElement elementLink, bool fUseCache)
        {
            if (elementLink != null)
            {
                IUIAutomationInvokePattern pattern = null;

                int iPatternId = _patternIdInvoke;

                // Will we be calling the Invoke() method through the Invoke pattern.
                // So first get the pattern for the hyperlink element.
                if (fUseCache)
                {
                    // This does not result in a cross-proc call here, and should not fail.
                    pattern = (IUIAutomationInvokePattern)elementLink.GetCachedPattern(iPatternId);
                }
                else
                {
                    // This will fail if the element no longer exists.
                    try
                    {
                        pattern = (IUIAutomationInvokePattern)elementLink.GetCurrentPattern(iPatternId);
                    }
                    catch
                    {
                        // If an exception is throw trying to access the element, do nothing. This will
                        // occur if the element no longer exists, (eg the browser window has been closed.)
                    }
                }

                if (pattern != null)
                {
                    pattern.Invoke();
                }
            }
        }
コード例 #20
0
        public static IUIAutomationElement FindDescendantByPath(
            this IUIAutomationElement element,
            string path
            )
        {
            var pathParts = path.Split(".".ToCharArray());

            // traverse the path
            var item = element;

            foreach (var pathPart in pathParts)
            {
                var next = item.FindFirst(
                    TreeScope.TreeScope_Descendants,
                    Helper.Automation.CreatePropertyCondition(
                        AutomationElementIdentifiers.LocalizedControlTypeProperty.Id,
                        pathPart
                        )
                    );

                if (next == null)
                {
                    ThrowUnableToFindChildException(path, item);
                }

                item = next;
            }

            return(item);
        }
コード例 #21
0
ファイル: EdgeA11yTools.cs プロジェクト: stanleyhon/A11y
 /// <summary>
 /// Get all the properties supported by an element
 /// </summary>
 /// <param name="element">The element being extended</param>
 /// <returns>A list of all the properties supported</returns>
 public static List <string> GetProperties(this IUIAutomationElement element)
 {
     int[]    ids;
     string[] names;
     new CUIAutomation8().PollForPotentialSupportedProperties(element, out ids, out names);
     return(names.ToList());
 }
コード例 #22
0
        private void EnumarateChildren(IUIAutomationElement element)
        {
            Console.WriteLine("{0}", element.CurrentName.Trim());


            IUIAutomationCacheRequest cacheRequest = _automation.CreateCacheRequest();

            cacheRequest.AddProperty(System.Windows.Automation.AutomationElement.NameProperty.Id);
            cacheRequest.AddProperty(System.Windows.Automation.AutomationElement.ControlTypeProperty.Id);
            cacheRequest.TreeScope = TreeScope.TreeScope_Element | TreeScope.TreeScope_Children | TreeScope.TreeScope_Subtree;

            IUIAutomationCondition cond;

            cond = _automation.CreatePropertyConditionEx(
                System.Windows.Automation.AutomationElement.ControlTypeProperty.Id,
                System.Windows.Automation.ControlType.Window.Id,
                PropertyConditionFlags.PropertyConditionFlags_IgnoreCase);

            IUIAutomationElementArray elementList = element.FindAllBuildCache(TreeScope.TreeScope_Children, cond, cacheRequest);

            if (elementList == null)
            {
                return;
            }

            for (int i = 0; i < elementList.Length; i++)
            {
                EnumarateChildren(elementList.GetElement(i));
            }
        }
コード例 #23
0
 public virtual extern void IUIAutomation3_PollForPotentialSupportedProperties(
     [MarshalAs(unmanagedType: UnmanagedType.Interface), In]
     IUIAutomationElement pElement,
     [MarshalAs(unmanagedType: UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_INT)]
     out int[] propertyIds,
     [MarshalAs(unmanagedType: UnmanagedType.SafeArray, SafeArraySubType = VarEnum.VT_BSTR)]
     out string[] propertyNames);
コード例 #24
0
        private void RegisterSelChangedEventAT(object state)
        {
            IUIAutomationElement elem = null;

            try {
                pAutomation.ElementFromHandle(handler.GetHwnd(), out elem);
                if (elem != null)
                {
                    pAutomation.AddAutomationEventHandler(UIA_Selection_InvalidatedEventId,
                                                          elem, TreeScope_Element, IntPtr.Zero, handler);
                    pAutomation.AddAutomationEventHandler(UIA_SelectionItem_ElementAddedToSelectionEventId,
                                                          elem, TreeScope_Descendants, IntPtr.Zero, handler);
                    pAutomation.AddAutomationEventHandler(UIA_SelectionItem_ElementRemovedFromSelectionEventId,
                                                          elem, TreeScope_Descendants, IntPtr.Zero, handler);
                    pAutomation.AddAutomationEventHandler(UIA_SelectionItem_ElementSelectedEventId,
                                                          elem, TreeScope_Descendants, IntPtr.Zero, handler);
                }
            }
            catch (Exception ex) {
            }
            finally {
                if (elem != null)
                {
                    Marshal.ReleaseComObject(elem);
                }
                ((AutoResetEvent)state).Set();
            }
        }
コード例 #25
0
        public static async Task <IUIAutomationElement> FindAutomationElementAsync(
            string elementName,
            bool recursive = false
            )
        {
            IUIAutomationElement element = null;
            var scope     = recursive ? TreeScope.TreeScope_Descendants : TreeScope.TreeScope_Children;
            var condition = Helper.Automation.CreatePropertyCondition(
                AutomationElementIdentifiers.NameProperty.Id,
                elementName
                );

            // TODO(Dustin): This is code is a bit terrifying. If anything goes wrong and the automation
            // element can't be found, it'll continue to spin until the heat death of the universe.
            await IntegrationHelper
            .WaitForResultAsync(
                () =>
                (element = Helper.Automation.GetRootElement().FindFirst(scope, condition))
                != null,
                expectedResult : true
                )
            .ConfigureAwait(false);

            return(element);
        }
        public static bool ExpandAll(this IUIAutomationElement element, IUIAutomation automation, int level)
        {
            if (element.CurrentIsOffscreen != 0)
            {
                return(false);
            }
            var returnValue = false;

            if (element.GetCurrentPattern(UIA_PatternIds.UIA_ExpandCollapsePatternId) is IUIAutomationExpandCollapsePattern expandCollapsePattern &&
                expandCollapsePattern.CurrentExpandCollapseState != ExpandCollapseState.ExpandCollapseState_LeafNode)
            {
                returnValue = true;
                // TODO: find timing issue and resolve structurally. This issue shows with CalcVolume
                Thread.Sleep(100);
                expandCollapsePattern.Expand();
            }

            var condition = automation.CreatePropertyCondition(UIA_PropertyIds.UIA_IsEnabledPropertyId, true);
            var item      = element.FindAll(TreeScope.TreeScope_Children, condition);

            for (var i = 0; i < item.Length; i++)
            {
                if (ExpandAll(item.GetElement(i), automation, level + 1))
                {
                    returnValue = true;
                }
            }

            return(returnValue);
        }
コード例 #27
0
        /// <summary>
        /// Creates a debug hint
        /// </summary>
        /// <param name="owningWindow">The window that owns the hint</param>
        /// <param name="hintBounds">The hint bounds</param>
        /// <param name="automationElement">The automation element</param>
        /// <returns>A debug hint</returns>
        private DebugHint CreateDebugHint(IntPtr owningWindow, Rect hintBounds, IUIAutomationElement automationElement)
        {
            // Enumerate all possible patterns. Note that the performance of this is *very* bad -- hence debug only.
            var programmaticNames = new List <string>();

            foreach (var pn in UiAutomationPatternIds.PatternNames)
            {
                try
                {
                    var pattern = automationElement.GetCurrentPattern(pn.Key);
                    if (pattern != null)
                    {
                        programmaticNames.Add(pn.Value);
                    }
                }
                catch (Exception)
                {
                }
            }

            if (programmaticNames.Any())
            {
                return(new DebugHint(owningWindow, hintBounds, programmaticNames.ToList()));
            }

            return(null);
        }
        public static bool CollapseAll(this IUIAutomationElement element, IUIAutomation automation)
        {
            if (element.CurrentIsOffscreen != 0)
            {
                return(false);
            }
            var returnValue = false;
            var condition   = automation.CreatePropertyCondition(UIA_PropertyIds.UIA_IsEnabledPropertyId, true);
            var item        = element.FindAll(TreeScope.TreeScope_Children, condition);

            for (var i = 0; i < item.Length; i++)
            {
                if (CollapseAll(item.GetElement(i), automation))
                {
                    returnValue = true;
                }
            }

            if (!(element.GetCurrentPattern(UIA_PatternIds.UIA_ExpandCollapsePatternId) is IUIAutomationExpandCollapsePattern
                  expandCollapsePattern) || expandCollapsePattern.CurrentExpandCollapseState ==
                ExpandCollapseState.ExpandCollapseState_LeafNode)
            {
                return(returnValue);
            }
            expandCollapsePattern.Collapse();
            return(true);
        }
コード例 #29
0
 /// <summary>
 /// This method will attempt to set the LegacyIAccessible Value of an element and then press TAB.
 /// </summary>
 /// <param name="element"></param>
 /// <param name="value"></param>
 public static void xtSetValue(this IUIAutomationElement element, string value)
 {
     _LegacyIAccessiblePattern = (IUIAutomationLegacyIAccessiblePattern)element.GetCurrentPattern(UIA_PatternIds.UIA_LegacyIAccessiblePatternId);
     _LegacyIAccessiblePattern.SetValue(value);
     Thread.Sleep(100);
     Keyboard.Instance.PressSpecialKey(TestStack.White.WindowsAPI.KeyboardInput.SpecialKeys.TAB);
 }
コード例 #30
0
        /// <summary>
        /// Adds the value of the ClickablePoint property to the A11yElement's Properties dictionary
        /// </summary>
        /// <remarks>
        /// Requesting the clickable point property in Edge can cause a crash,
        /// so the clickable point property is not initially populated by <see cref="DesktopElementExtensionMethods.PopulatePropertiesAndPatternsFromCache(A11yElement)"/>.
        /// </remarks>
        private static void InitClickablePointProperty(this A11yElement a11yElement, IUIAutomationElement uiaElement)
        {
            if (a11yElement.IsEdgeElement())
            {
                return;
            }

            int id = PropertyType.UIA_ClickablePointPropertyId;

            double[] clickablePoint = uiaElement.GetCurrentPropertyValue(id);
            if (clickablePoint == null)
            {
                return;
            }

            string name = A11yAutomation.UIAutomationObject.GetPropertyProgrammaticName(id);

            var prop = new A11yProperty
            {
                Id    = id,
                Name  = name,
                Value = new Point((int)clickablePoint[0], (int)clickablePoint[1])
            };

            a11yElement.Properties.Add(id, prop);
        }
コード例 #31
0
        /////////////////////////////////////////////////////////////////////////////////////////////////
        //
        // HandleStructureChangedEvent()
        //
        // Sample application's handler for UIA StructureChanged events.
        //
        // Runs on a background thread create by UIA.
        //
        /////////////////////////////////////////////////////////////////////////////////////////////////
        public void HandleStructureChangedEvent(IUIAutomationElement sender, StructureChangeType changeType, int[] array)
        {
            // A structure changed event has been sent by the browser window element or some descendant of it.

            // Check that this event hasn't arrived around the time we're removing the event handler on shutdown.
            if (!_fAddedEventHandler)
            {
                return;
            }

            // For this sample, all the event handler needs to do is notify the main UI thread that the
            // list of hyperlinks should be refreshed to make sure it's showing the most current list.

            // A shipping event handler might want to interact with the sender of the events.
            // For example if this was a Focus Changed event handler, it might get the cached
            // bounding rect from the sender to highlight where focus is now. Preferably the
            // work done is kept to a minimum in the UIA event handler itself, so the handler
            // could signal to another thread that action is required.

            // Note that the browser window can send many Structure Changed events in rapid succession.
            // There's nothing to be gained by trying to act on every event received, so only refresh
            // the list of hyperlinks 2 seconds after an event is received. (This delay would want to
            // be tuned for the best user experience in a shipping app.)

            if (_timerRefresh == null)
            {
                _timerRefresh          = new System.Windows.Forms.Timer();
                _timerRefresh.Tick    += new EventHandler(timerRefresh_Tick);
                _timerRefresh.Interval = 2000;

                _timerRefresh.Start();
            }
        }
コード例 #32
0
 StructureChangedEventHandlerImpl(
     IUIAutomationElement uiAutomationElement,
     StructureChangedEventHandler handlingDelegate)
 {
     this._uiAutomationElement = uiAutomationElement;
     this._handlingDelegate    = handlingDelegate;
 }
コード例 #33
0
        public ViewManager(IntPtr hwnd)
        {
            _rootElement = _automation.ElementFromHandle(hwnd);
            if (null == _rootElement)
            {
                throw this.exception;
            }

            this.vt = new ViewTree(_rootElement, _automation);
            this.vt.BuildTree();
        }
コード例 #34
0
        public void ClickElement(IUIAutomationElement element)
        {
            int left = element.CurrentBoundingRectangle.left;
            int right = element.CurrentBoundingRectangle.right;
            int top = element.CurrentBoundingRectangle.top;
            int bottom = element.CurrentBoundingRectangle.bottom;
            int x = (left + right) / 2;
            int y = (top + bottom) / 2;

            NativeMethods.SetCursorPos(x, y);
            Mouse.LeftClick();

            Thread.Sleep(3000);
        }
コード例 #35
0
        public void MyTestInitialize()
        {
            // Create the factory and register schemas
            _factory = new CUIAutomationClass();
            ReadyStateSchema.GetInstance().Register();
            TestSchema.GetInstance().Register();
            ColorSchema.GetInstance().Register();

            // Start the app
            var curDir = Environment.CurrentDirectory;
            _app = new TargetApp(curDir + "\\UiaControls.exe");
            _app.Start();

            // Find the main control
            var appElement = _factory.ElementFromHandle(_app.MainWindow);
            var condition = _factory.CreatePropertyCondition(
                UIA_PropertyIds.UIA_AutomationIdPropertyId,
                "triColorControl1");
            _customElement = appElement.FindFirst(TreeScope.TreeScope_Children,
                                                  condition);
            Assert.IsNotNull(_customElement);
        }
コード例 #36
0
 public void ScrollToRight(IUIAutomationElement element)
 {
     Scroller.HorScroll(element.CurrentNativeWindowHandle, 200);
     Thread.Sleep(1000);
 }
コード例 #37
0
 public void Dispose() {
     if(pElement != null) {
         Marshal.ReleaseComObject(pElement);
         pElement = null;
     }
     GC.SuppressFinalize(this);
 }
コード例 #38
0
        public IUIAutomationElement GetReportElement(IUIAutomationElement rootElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Report this review");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_GroupControlTypeId);
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "pdpReportReviewMenu");
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement reportElement = rootElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            return reportElement;
        }
コード例 #39
0
        public IUIAutomationElement GetTopFreeHome(IUIAutomationElement element)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[2];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Top free");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_ListItemControlTypeId);

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement topFreeElement = element.FindFirst(TreeScope.TreeScope_Subtree, conditions);
            Console.WriteLine(topFreeElement.CurrentName);

            return topFreeElement;
        }
コード例 #40
0
        public IUIAutomationElement GetUpdateDocumentElement(IUIAutomationElement rootElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_DocumentControlTypeId);
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "frameHeader");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "document");

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement updateElement = rootElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            return updateElement;
        }
コード例 #41
0
        public void GoBack(IUIAutomationElement updateElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_ButtonControlTypeId);
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Back");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "backButton");
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement backElement = updateElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            this.ClickElement(backElement);
            Thread.Sleep(2000);
        }
コード例 #42
0
ファイル: Button.cs プロジェクト: MichaelBergerman/TestR
 internal Button(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #43
0
ファイル: CheckBox.cs プロジェクト: MichaelBergerman/TestR
 internal CheckBox(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #44
0
ファイル: Hyperlink.cs プロジェクト: MichaelBergerman/TestR
 internal Hyperlink(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #45
0
 private AutomationElement(IUIAutomationElement elem) {
     pElement = elem;
     lock(typeof(AutomationElement)) {
         ++instances;
     }
 }
コード例 #46
0
ファイル: DesktopElement.cs プロジェクト: BobbyCannon/TestR
 /// <summary>
 /// Creates an instance of a desktop element.
 /// </summary>
 /// <param name="element"> The automation element for this element. </param>
 /// <param name="application"> The application parent for this element. </param>
 /// <param name="parent"> The parent element for this element. </param>
 protected DesktopElement(IUIAutomationElement element, Application application, ElementHost parent)
     : base(application, parent)
 {
     NativeElement = element;
 }
コード例 #47
0
ファイル: DesktopElement.cs プロジェクト: BobbyCannon/TestR
        /// <summary>
        /// Creates an element from the automation element.
        /// </summary>
        /// <param name="element"> The element to create. </param>
        /// <param name="application"> The application parent for this element. </param>
        /// <param name="parent"> The parent of the element to create. </param>
        internal static DesktopElement Create(IUIAutomationElement element, Application application, DesktopElement parent)
        {
            var itemType = element.CurrentControlType;

            switch (itemType)
            {
                case UIA_ControlTypeIds.UIA_ButtonControlTypeId:
                    return new Button(element, application, parent);

                case UIA_ControlTypeIds.UIA_CalendarControlTypeId:
                    return new Calendar(element, application, parent);

                case UIA_ControlTypeIds.UIA_CheckBoxControlTypeId:
                    return new CheckBox(element, application, parent);

                case UIA_ControlTypeIds.UIA_ComboBoxControlTypeId:
                    return new ComboBox(element, application, parent);

                case UIA_ControlTypeIds.UIA_CustomControlTypeId:
                    return new Custom(element, application, parent);

                case UIA_ControlTypeIds.UIA_DataGridControlTypeId:
                    return new DataGrid(element, application, parent);

                case UIA_ControlTypeIds.UIA_DataItemControlTypeId:
                    return new DataItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_DocumentControlTypeId:
                    return new Document(element, application, parent);

                case UIA_ControlTypeIds.UIA_EditControlTypeId:
                    return new Edit(element, application, parent);

                case UIA_ControlTypeIds.UIA_GroupControlTypeId:
                    return new Group(element, application, parent);

                case UIA_ControlTypeIds.UIA_HeaderControlTypeId:
                    return new Header(element, application, parent);

                case UIA_ControlTypeIds.UIA_HeaderItemControlTypeId:
                    return new HeaderItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_HyperlinkControlTypeId:
                    return new Hyperlink(element, application, parent);

                case UIA_ControlTypeIds.UIA_ImageControlTypeId:
                    return new Image(element, application, parent);

                case UIA_ControlTypeIds.UIA_ListControlTypeId:
                    return new List(element, application, parent);

                case UIA_ControlTypeIds.UIA_ListItemControlTypeId:
                    return new ListItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_MenuControlTypeId:
                    return new Menu(element, application, parent);

                case UIA_ControlTypeIds.UIA_MenuBarControlTypeId:
                    return new MenuBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_MenuItemControlTypeId:
                    return new MenuItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_PaneControlTypeId:
                    return new Pane(element, application, parent);

                case UIA_ControlTypeIds.UIA_ProgressBarControlTypeId:
                    return new ProgressBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_RadioButtonControlTypeId:
                    return new RadioButton(element, application, parent);

                case UIA_ControlTypeIds.UIA_SeparatorControlTypeId:
                    return new Separator(element, application, parent);

                case UIA_ControlTypeIds.UIA_ScrollBarControlTypeId:
                    return new ScrollBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_SemanticZoomControlTypeId:
                    return new SemanticZoom(element, application, parent);

                case UIA_ControlTypeIds.UIA_SliderControlTypeId:
                    return new Slider(element, application, parent);

                case UIA_ControlTypeIds.UIA_SpinnerControlTypeId:
                    return new Spinner(element, application, parent);

                case UIA_ControlTypeIds.UIA_SplitButtonControlTypeId:
                    return new SplitButton(element, application, parent);

                case UIA_ControlTypeIds.UIA_StatusBarControlTypeId:
                    return new StatusBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_TabControlTypeId:
                    return new TabControl(element, application, parent);

                case UIA_ControlTypeIds.UIA_TabItemControlTypeId:
                    return new TabItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_TableControlTypeId:
                    return new Table(element, application, parent);

                case UIA_ControlTypeIds.UIA_TextControlTypeId:
                    return new Text(element, application, parent);

                case UIA_ControlTypeIds.UIA_ThumbControlTypeId:
                    return new Thumb(element, application, parent);

                case UIA_ControlTypeIds.UIA_TitleBarControlTypeId:
                    return new TitleBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_ToolBarControlTypeId:
                    return new ToolBar(element, application, parent);

                case UIA_ControlTypeIds.UIA_ToolTipControlTypeId:
                    return new ToolTip(element, application, parent);

                case UIA_ControlTypeIds.UIA_TreeControlTypeId:
                    return new Tree(element, application, parent);

                case UIA_ControlTypeIds.UIA_TreeItemControlTypeId:
                    return new TreeItem(element, application, parent);

                case UIA_ControlTypeIds.UIA_WindowControlTypeId:
                    return new Window(element, application, parent);

                default:
                    Debug.WriteLine("Need to add support for [" + itemType + "] element.");
                    return new DesktopElement(element, application, parent);
            }
        }
コード例 #48
0
ファイル: Document.cs プロジェクト: MichaelBergerman/TestR
 internal Document(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #49
0
ファイル: Header.cs プロジェクト: MichaelBergerman/TestR
 internal Header(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #50
0
ファイル: ToolTip.cs プロジェクト: MichaelBergerman/TestR
 internal ToolTip(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #51
0
        public IUIAutomationElement GetUpdateLinkElement(IUIAutomationElement updateDocumentElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[3];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_HyperlinkControlTypeId);
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "headerLinkUpdates");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement updateLinkElement = updateDocumentElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            return updateLinkElement;
        }
コード例 #52
0
ファイル: Window.cs プロジェクト: MichaelBergerman/TestR
 internal Window(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #53
0
ファイル: List.cs プロジェクト: BobbyCannon/TestR
		internal List(IUIAutomationElement element, Application application, DesktopElement parent)
			: base(element, application, parent)
		{
		}
コード例 #54
0
ファイル: SplitButton.cs プロジェクト: BobbyCannon/TestR
		internal SplitButton(IUIAutomationElement element, Application application, DesktopElement parent)
			: base(element, application, parent)
		{
		}
コード例 #55
0
        public IUIAutomationElement[] GetTopFreeHomeArray(IUIAutomationElement element)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[2];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Top free");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_ListItemControlTypeId);

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElementArray topFreeList = element.FindAll(TreeScope.TreeScope_Children, conditions);

            IUIAutomationElement[] topFreeArray = new IUIAutomationElement[topFreeList.Length];
            for (int i = 0; i < topFreeList.Length; i++)
            {
                topFreeArray[i] = topFreeList.GetElement(i);
            }

            return topFreeArray;
        }
コード例 #56
0
ファイル: ProgressBar.cs プロジェクト: MichaelBergerman/TestR
 internal ProgressBar(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #57
0
        public IUIAutomationElement GetScrollingContainerElement(IUIAutomationElement rootElement)
        {
            IUIAutomationCondition[] conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "wsFrame");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_DocumentControlTypeId);
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "document");

            IUIAutomationCondition conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement frameElement = rootElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            conditionArray = new IUIAutomationCondition[3];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_AutomationIdPropertyId, "mainContent");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_ListControlTypeId);

            conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement contentElement = frameElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            conditionArray = new IUIAutomationCondition[4];
            conditionArray[0] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_NamePropertyId, "Scrolling Container");
            conditionArray[1] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_ControlTypePropertyId, UIA_ControlTypeIds.UIA_GroupControlTypeId);
            conditionArray[2] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_FrameworkIdPropertyId, "InternetExplorer");
            conditionArray[3] = _automation.CreatePropertyCondition(UIA_PropertyIds.UIA_LocalizedControlTypePropertyId, "group");

            conditions = _automation.CreateAndConditionFromArray(conditionArray);
            IUIAutomationElement scrollingContainerElement = contentElement.FindFirst(TreeScope.TreeScope_Children, conditions);

            return scrollingContainerElement;
        }
コード例 #58
0
 internal SemanticZoom(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #59
0
ファイル: ListItem.cs プロジェクト: MichaelBergerman/TestR
 internal ListItem(IUIAutomationElement element, Application application, Element parent)
     : base(element, application, parent)
 {
 }
コード例 #60
0
 internal AutomationElement(IUIAutomationElement pElement, AutomationElementFactory factory) {
     this.factory = factory;
     this.pElement = pElement;
     factory.AddToDisposeList(this);
 }