Пример #1
0
        public void TestReadyStateProperty()
        {
            // Query our custom property
            var readyStateValue = _customElement.GetCurrentPropertyValue(ReadyStateSchema.GetInstance().ReadyStateProperty.PropertyId);

            Assert.IsInstanceOf <string>(readyStateValue);

            // By default, UIAControls.exe launches in not-ready state
            Assert.AreEqual("Not Ready", readyStateValue);
        }
Пример #2
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);
        }