Cannot capture Windows Messagebox text from a WPF application

4 posts, 0 answers
  1. Ras
    Ras avatar
    3 posts
    Member since:
    Feb 2014

    Posted 14 Mar 2014 Link to this post

    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.

  2. Ras
    Ras avatar
    3 posts
    Member since:
    Feb 2014

    Posted 16 Mar 2014 Link to this post

    Ok, I guess Telerik Cannot do this then...

    Thanks.
  3. Ras
    Ras avatar
    3 posts
    Member since:
    Feb 2014

    Posted 17 Mar 2014 Link to this post

    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)

  4. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 18 Mar 2014 Link to this post

    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
     
Back to Top