开发者

Getting started with UIAutomation

开发者 https://www.devze.com 2023-03-29 16:03 出处:网络
I\'m trying to find a good resource to get started with UIAutomation. I need to simulate mouse input in a WPF application. Are there any good examples out there? I couldn\'t find any开发者_如何学C, an

I'm trying to find a good resource to get started with UIAutomation. I need to simulate mouse input in a WPF application. Are there any good examples out there? I couldn't find any开发者_如何学C, and the MSDN documentation seems too extensive.


UI Automation is not really intended to simulate mouse clicks. It is meant to expose the user interface in a programmatically-accessible fashion.

It organizes controls in a hierarchy that can be easily traversed/navigated by screen readers or similar applications. And, it uses control patterns to allow users to interact with the controls.

A Button for example can expose the InvokePattern via it's automation peer. You can simulate a click using the Invoke method on that pattern. This is done independently of the mouse, so there would be no mouse over/enter/leave/down events, just a Click event.


You can use mouse class with UIAutomation. But as CodeNaked rightly said, we should use UIAutomation patterns for mouse like operations and it is not good practice to use mouse class.

You can refer this code project article to start with UIAutomation.

I hope this will help you.

0

精彩评论

暂无评论...
验证码 换一张
取 消