This is a migrated thread and some comments may be shown as answers.

Get class name of WPF window.

4 Answers 83 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Evgeniy
Top achievements
Rank 1
Evgeniy asked on 08 Apr 2015, 02:48 PM

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

Sort by
0
Accepted
Cody
Telerik team
answered on 09 Apr 2015, 12:15 AM
Hi Evgeniy,

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
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Evgeniy
Top achievements
Rank 1
answered on 09 Apr 2015, 07:26 AM

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.

0
Cody
Telerik team
answered on 09 Apr 2015, 04:00 PM
Hi Evgeniy,

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
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
0
Evgeniy
Top achievements
Rank 1
answered on 10 Apr 2015, 06:18 AM
Hello. Thanks for your advice, that is a good idea. The content of this windows is different, so I can check my window by checking several UI-controls on it.
Tags
General Discussions
Asked by
Evgeniy
Top achievements
Rank 1
Answers by
Cody
Telerik team
Evgeniy
Top achievements
Rank 1
Share this question
or