can we identify that an error message box has appeared

Ask general questions here.
arishahsan
Posts: 26
Joined: Thu Jan 18, 2007 12:04 pm

can we identify that an error message box has appeared

Post by arishahsan » Thu Jan 18, 2007 12:13 pm

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

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Thu Jan 18, 2007 7:40 pm

A message box is a top level window, you should use the Application.FindFormTitle function to find it:

Code: Select all

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

arishahsan
Posts: 26
Joined: Thu Jan 18, 2007 12:04 pm

Still have problem

Post by arishahsan » Fri Jan 19, 2007 3:04 pm

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.

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Sat Jan 20, 2007 1:23 am

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: Select all

Form activeForm = Application.Active;
Console.WriteLine("ActiveForm Title={0} ClassName={1}", 
    activeForm.Text, activeForm.ClassName);
Jenö Herget
Ranorex Team

arishahsan
Posts: 26
Joined: Thu Jan 18, 2007 12:04 pm

ok thats nice technique

Post by arishahsan » Mon Jan 22, 2007 6:04 am

could u tell me in which version of ranorex Application.Active is available.
Is it in free version ?

admin
Site Admin
Site Admin
Posts: 350
Joined: Wed Jul 05, 2006 7:44 pm

Post by admin » Mon Jan 22, 2007 9:40 pm

Application.Active is available in all Ranorex versions...

Gabor Herget
Ranorex Team

luis.toledo
Posts: 2
Joined: Thu Oct 25, 2007 5:13 pm

Post by luis.toledo » Fri Oct 26, 2007 1:22 am

Can't see that :(
Im using Version 1.2 on VS C# Express Edition

Image

Tnx!

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Fri Oct 26, 2007 8:32 am

Please use the Form.Active property in V1.2 or higher.

Code: Select all

public static Form Active { get; }
You get the currently active top level form.

Jenö
Ranorex Team