alf
alf

Reputation: 18530

Getting started with UIAutomation

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, and the MSDN documentation seems too extensive.

Upvotes: 2

Views: 768

Answers (2)

CSharp
CSharp

Reputation: 1583

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.

Upvotes: 0

CodeNaked
CodeNaked

Reputation: 41393

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.

Upvotes: 3

Related Questions