How can I programmatically click a Button?
Button, like many other WPF controls, has a peer class in the
System.Windows.Automation.Peers namespace to support UI Automation:
ButtonAutomationPeer. It can be used as follows with a Button called myButton:
testing and accessibility.
System.Windows.Automation.Peers namespace to support UI Automation:
ButtonAutomationPeer. It can be used as follows with a Button called myButton:
ButtonAutomationPeer bap = new ButtonAutomationPeer(myButton); IInvokeProvider iip = bap.GetPattern(PatternInterface.Invoke) as IInvokeProvider; iip.Invoke(); // This clicks the ButtonThese UI Automation classes have several members that are extremely useful for automated
testing and accessibility.
댓글
댓글 쓰기