2
votes

I am trying to Automate a WPF application with Coded UI Test 2010.I am able to hand code to identify the WPF controls in the Application However I could not able to find some controls.

I did some r&d and got to know that few are custom controls in the application.This was the reason why the playback failed.

I tried with record and playback too but no use. I got a reference link to resolve the problem

http://msdn.microsoft.com/en-us/library/hh552522.aspx#recordandplayback

But I didn't understand from where we need to start.

1

1 Answers

0
votes

Coded UI does support WPF, so as long as there are identifiable properties of the object you are pointing to, it should then be just a matter of properly defining the object in code. For example, a custom object could be defined as, at it's root, a XamlControl. You lose out on some of the extension methods available to controls like ComboBoxes (SelectedItem(), SelectedIndex(), etc.), but it should still work. There's some good information here regarding the inheritance of Xaml controls.

For example, define your control by it's ID or title:

public XamlControl myCustomControl
{
    get
    {
        XamlControl target = new XamlControl();
        target.SearchProperties["title"] = "hard to find control";
        return target;
    }
}