Dialog box

9 posts, 0 answers
  1. Roman
    Roman avatar
    4 posts
    Member since:
    Oct 2013

    Posted 16 Oct 2013 Link to this post

    Hi, 
    i am running a WPF app and i have a dialog box and i cant find it by code... i managed to find different one but it had just OK button on it.
    my code is 

    GenericDialog ad = new GenericDialog(ActiveApplication, "Question", true, "Ne", "Set next free Order No.?");
    Manager.DialogMonitor.AddDialog(ad);
    Manager.DialogMonitor.Start();

    //some code until i get to the dialog

    ad.WaitUntilHandled(5000);
    Manager.DialogMonitor.Stop();

    i tryed to replicate it in Testu Studio and there it works only when i set  HandleButtonMethod to ButtonPartialText and i set the test same as in code here.

    I did not managed to find whot am i doing differently or wrong.

    Could you tell me how to replicate by code the HandleButtonMethod set to ButtonPartialText ?

    and it would be great if you could tell me where i could find reference to dialogs currently displayd (atached to main window?)


  2. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 16 Oct 2013 Link to this post

    Misread the original post.  I can't find anything technically wrong with your code, but I did find the following (albeit it being over 2 years old now):

    http://www.telerik.com/automated-testing-tools/community/forums/test-studio-express/automation-framework/arguments-in-generic-dialog.aspx

    Try using this instead:

    GenericDialog ad = new GenericDialog(ActiveApplication, "Question", true, "Ne", "");

    If that works...welll it's been over 2 years if that does indeed work.
  3. Daniel
    Daniel avatar
    13 posts
    Member since:
    Aug 2013

    Posted 16 Oct 2013 Link to this post

    Another option, just to try out, would be the following:

    GenericDialog ad = new GenericDialog(ActiveApplication, "Question", false, "");
    ad.ButtonText = "Se";
    Manager.DialogMonitor.AddDialog(ad);

    Changing the HandleButtonMethod in Visual Studio arranges the setup a bit differently in code.  Changing from ButtonID to ButtonPartialText and previewing the code results in what I posted above.
  4. Roman
    Roman avatar
    4 posts
    Member since:
    Oct 2013

    Posted 17 Oct 2013 Link to this post

    thank you for the reply,
    i tryed both suggestions and they both dont work for me :(
    i tryed a loot of combinations on the constructor eaven with static strings...

    i would be happy if i could somehow get like list of current dialogs showing on screen, i did not manage to find it in the data structure or a function to get it..
  5. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 21 Oct 2013 Link to this post

    Hello,

    @Daniel - Thank you for suggesting these solutions and helping others. We really appreciate it. I have updated your Telerik Points 
    @Roman - No, you can't get a list of the current dialogs that are shown on the screen. You can only use Manager.DialogMonitor.Dialogs.ToList<> to get a list of the dialogs that you are currently monitoring.

    One thing you can use to resolve your problem is to use one of the other GenericDialog constructors that use buttonId, not buttonText. If you are using buttonId, 0 should be the first button (Ano) and 1 should be the second button (Ne). You can try for example with:
    GenericDialog ad = new GenericDialog(ActiveApplication, "Question", true,  1);

    You can also try with the other suggestions that the IntelliSense will offer you. 

    Let me know if this helps.

    Regards,
    Velin Koychev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  6. Roman
    Roman avatar
    4 posts
    Member since:
    Oct 2013

    Posted 22 Oct 2013 Link to this post

    Thank you for the suggestion Velin,
    i tried your suggestion and it does not work for me, i don't know what is the problem on this dialog but it works in TestStudio but not coded by hand..
    if it helps it a basic dialog shown like this..
    MessageBox.Show("Set next free Order No.?","Question", MessageBoxButton.YesNo, MessageBoxImage.Question)
  7. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 24 Oct 2013 Link to this post

    Hi Roman,

    Thank you for sending us the sample code. I build a WPF application using the same code and also changed the display language of my machine to Czech. 

    I was able to handle the dialog with the following code:

    GenericDialog ad = new GenericDialog(ActiveApplication, "Question", "Ne", true);

    Let me know if this helps.

    Regards,
    Velin Koychev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
  8. Roman
    Roman avatar
    4 posts
    Member since:
    Oct 2013

    Posted 25 Oct 2013 Link to this post

    Thanks for the answer Velin,
    I dont realy know whot its wrong with my computer but it does not manage to find this particular dialog,
    i will reinstal windows in near future and then try it again maybe it helps finaly :D 
  9. Velin Koychev
    Admin
    Velin Koychev avatar
    88 posts

    Posted 29 Oct 2013 Link to this post

    Hello Roman,

    OK, just let us know whether reinstalling Windows helped you resolve this problem. 

    You can also provide us with a sample application where you experience this problem, so we can try to reproduce exactly the same test scenario as yours.  

    Looking forward to hearing from you.

    Regards,
    Velin Koychev
    Telerik
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top