| View previous topic :: View next topic |
| Author |
Message |
arishahsan
Joined: 18 Jan 2007 Posts: 26
|
Posted: Thu Jan 18, 2007 1:13 pm Post subject: can we identify that an error message box has appeared |
|
| can we identify that an error message box has appeared while performing an automated testing on a software using ranorex .....Note that the error message box has poped up from the software which I am testing |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Thu Jan 18, 2007 8:40 pm Post subject: |
|
A message box is a top level window, you should use the Application.FindFormTitle function to find it:
Code: click into code to enlarge
Form messageBox = Application.FindFormTitle("MessageBox title", SearchMatchMode.MatchExact, true, 100);
Control control = messageBox.FindChildText("OK", SearchMatchMode.MatchExact);
Mouse.ClickControl(control);
See also the sample RanorexVS2003Sample3
Gabor Herget
Ranorex Team |
|
| Back to top |
|
 |
arishahsan
Joined: 18 Jan 2007 Posts: 26
|
Posted: Fri Jan 19, 2007 4:04 pm Post subject: Still have problem |
|
First of all thanks for such a quick responce....
but my problem is not solved by that answer
as per given code we shold know the title of
error message and other details but I want to
know that is there any way to identify it without
having details of the error message form. I mean
the program itself identify that the opened window
is an error window while performing some automated
task on some application. |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Sat Jan 20, 2007 2:23 am Post subject: |
|
You can get the active form with the Application.Active property.
If the active form is not your test application, then check if it's a message box.
Code: click into code to enlarge
Form activeForm = Application.Active;
Console.WriteLine("ActiveForm Title={0} ClassName={1}",
activeForm.Text, activeForm.ClassName);
Jenö Herget
Ranorex Team |
|
| Back to top |
|
 |
arishahsan
Joined: 18 Jan 2007 Posts: 26
|
Posted: Mon Jan 22, 2007 7:04 am Post subject: ok thats nice technique |
|
could u tell me in which version of ranorex Application.Active is available.
Is it in free version ? |
|
| Back to top |
|
 |
admin Site Admin
Joined: 05 Jul 2006 Posts: 351
|
Posted: Mon Jan 22, 2007 10:40 pm Post subject: |
|
Application.Active is available in all Ranorex versions...
Gabor Herget
Ranorex Team |
|
| Back to top |
|
 |
luis.toledo
Joined: 25 Oct 2007 Posts: 2
|
|
| Back to top |
|
 |
Support Team Site Admin
Joined: 07 Jul 2006 Posts: 257
|
Posted: Fri Oct 26, 2007 9:32 am Post subject: |
|
Please use the Form.Active property in V1.2 or higher.
Code: click into code to enlarge
public static Form Active { get; }
You get the currently active top level form.
Jenö
Ranorex Team |
|
| Back to top |
|
 |
|