GetStartButton() public static méthode

public static GetStartButton ( ) : AutomationElement
Résultat System.Windows.Automation.AutomationElement
        public void MyTestInitialize()
        {
            // Find the Start button, which will be our target
            AutomationElement trueStartButton = AutomationElementTest.GetStartButton();

            this.startButtonHwnd = (IntPtr)trueStartButton.Current.NativeWindowHandle;
        }
Exemple #2
0
        public void TestInvokeEvent()
        {
            AutomationElement  startButton = AutomationElementTest.GetStartButton();
            BasicChangeHandler handler     = new BasicChangeHandler();

            Automation.AddAutomationEventHandler(
                InvokePattern.InvokedEvent,
                startButton,
                TreeScope.Element,
                new AutomationEventHandler(handler.HandleEvent));
            handler.Start();
            InvokePattern invoke = (InvokePattern)startButton.GetCurrentPattern(InvokePattern.Pattern);

            invoke.Invoke();
            System.Windows.Forms.SendKeys.SendWait("{ESC}");
            Assert.IsTrue(handler.Confirm());
            Assert.IsNotNull(handler.EventSource);
            Automation.RemoveAutomationEventHandler(
                InvokePattern.InvokedEvent,
                startButton,
                new AutomationEventHandler(handler.HandleEvent));
        }