Hello.
I'm trying to automate one WPF application, and I need to check if my wpf window has the correct class name. How can I do that?
Here is the part of XAML page code (I need to get class name "Namespace.View".):
<WindowViewBase
x:Class="Namespace.View"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<!-- some controls here -->
</WindowViewBase>
4 Answers, 1 is accepted
I'm afraid it's not possible. The class is compiled into the assembly and not put into the Visual Tree which is what Test Studio uses for automation. In addition Test Studio uses element wrappers for all UI elements making it not possible to discover what type a particular UI element is created as.
Now having said that, what is your need to detect the class name? Maybe there's another way to accomplish your testing needs.
Regards,
Cody
Telerik
Test Studio Trainings
Hello Cody.
Thanks for your answer.
I wanted to check if the right window opens after the click on button. The problem is that there are several windows that can open after the click, and I don't know which window will open. All this windows have the same title, but different XAML class names, that's why I wanted to check XAML class name.
I would tackle this by looking for some content in the window. I assume, even though the title is the same, the content will be different. Thus if the window has X, where X is some text value or the presence of some specific UI element, then it opened the "right" window.
Regards,
Cody
Telerik
Test Studio Trainings