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

Dialog box

8 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Roman
Top achievements
Rank 1
Roman asked on 16 Oct 2013, 01:02 PM
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?)


8 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 2
answered on 16 Oct 2013, 06:47 PM

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.
0
Daniel
Top achievements
Rank 2
answered on 16 Oct 2013, 07:14 PM
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.
0
Roman
Top achievements
Rank 1
answered on 17 Oct 2013, 07:00 AM
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..
0
Velin Koychev
Telerik team
answered on 21 Oct 2013, 12:07 PM
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
0
Roman
Top achievements
Rank 1
answered on 22 Oct 2013, 05:44 AM
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)
0
Velin Koychev
Telerik team
answered on 24 Oct 2013, 12:00 PM
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
0
Roman
Top achievements
Rank 1
answered on 25 Oct 2013, 08:41 AM
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 
0
Velin Koychev
Telerik team
answered on 29 Oct 2013, 11:52 AM
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
Tags
General Discussions
Asked by
Roman
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 2
Roman
Top achievements
Rank 1
Velin Koychev
Telerik team
Share this question
or