Automation.UI.Examples.Example1.QueryExample C# (CSharp) Méthode

QueryExample() private méthode

private QueryExample ( ) : void
Résultat void
        private void QueryExample()
        {
            var root = AutomationElement.RootElement;
            var window = UITree.Query(root).UsingTreeWalkerEngine()
                // Query 1.
                .FindChildren().Where()
                .Name().Contains("Microsoft Visual Studio")
                .And()
                .Type().Is(ControlType.Window)
                .Select().FirstResult();

            var titleBar = UITree.Query(window).UsingDefaultEngine()
                // Query 2
                .FindChildren().Where()
                .Type().Is(ControlType.TitleBar)
                .Select().FirstResult();

            Console.WriteLine(titleBar.Element.Current.Name);
        }

Usage Example

        public static void Main(string[] args)
        {
            Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));

            var example = new Example1();
            example.QueryExample();
            example.QueryBuilderExample();
            example.PatternExample();
        }
All Usage Examples Of Automation.UI.Examples.Example1::QueryExample