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

Cannot capture Windows Messagebox text from a WPF application

3 Answers 96 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ras
Top achievements
Rank 1
Ras asked on 14 Mar 2014, 07:29 AM
Hi 

I'm using the demo version of the telerik test studio in visual studio and planning to purchase the product to automate a WPF application.

As in the given screenshot, when I click on the Submit button, A messagebox appears.
And I need to get the text given in the messagebox for verification.

But I can't seem to get the text using any method given in your documentation.

http://docs.telerik.com/teststudio/user-guide/code-samples/html/verify-dialog-text.aspx

Quick help is really appreciated.


Thanks You.

3 Answers, 1 is accepted

Sort by
0
Ras
Top achievements
Rank 1
answered on 17 Mar 2014, 03:28 AM
Ok, I guess Telerik Cannot do this then...

Thanks.
0
Ras
Top achievements
Rank 1
answered on 17 Mar 2014, 10:44 AM
01.ArtOfTest.Common.Win32.Window vsWindow = null;
02.WindowManager winManager = new WindowManager();
03.winManager.GetWindows();
04. 
05.foreach (ArtOfTest.Common.Win32.Window win in winManager.Items)
06.{
07.    if (win.Caption.Contains("Error"))
08.        vsWindow = win;
09.}
10. 
11.string emsg1 = vsWindow.GetText();
12. 
13.string emsg2 = vsWindow.AllChildren[vsWindow.AllChildren.Count - 1].Caption;

Found a way of doing this with the above code. (using ArtOfTest.WebAii.Win32 namespace)

0
Velin Koychev
Telerik team
answered on 18 Mar 2014, 02:19 PM
Hi Ras,

It seems you were able to figure out how to accomplish this test scenario. Thank you for sharing your solution. 

Let me know if you need any additional assistance. 

Regards,
Velin Koychev
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
Ras
Top achievements
Rank 1
Answers by
Ras
Top achievements
Rank 1
Velin Koychev
Telerik team
Share this question
or