Ranorex

can we identify that an error message box has appeared

 
Post new topic   Reply to topic    Ranorex Forum Index -> General Questions
View previous topic :: View next topic  
Author Message
arishahsan



Joined: 18 Jan 2007
Posts: 26

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
arishahsan



Joined: 18 Jan 2007
Posts: 26

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: 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
View user's profile Send private message Visit poster's website
arishahsan



Joined: 18 Jan 2007
Posts: 26

PostPosted: 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
View user's profile Send private message
admin
Site Admin


Joined: 05 Jul 2006
Posts: 351

PostPosted: Mon Jan 22, 2007 10:40 pm    Post subject:
Application.Active is available in all Ranorex versions...

Gabor Herget
Ranorex Team
Back to top
View user's profile Send private message Visit poster's website
luis.toledo



Joined: 25 Oct 2007
Posts: 2

PostPosted: Fri Oct 26, 2007 2:22 am    Post subject:
Can't see that Sad
Im using Version 1.2 on VS C# Express Edition



Tnx!
Back to top
View user's profile Send private message
Support Team
Site Admin


Joined: 07 Jul 2006
Posts: 257

PostPosted: 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
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Ranorex Forum Index -> General Questions All times are GMT + 2 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum