modal window hidden instead of closed

Ranorex Spy, Recorder, and Studio.
Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

modal window hidden instead of closed

Post by Chris Wright » Fri Nov 04, 2011 10:56 am

Hi,

Hopefully someone can help.

I have recorded a test where our application opens one modal window and then another modal window from that. A test is recorded where the active window has an item selected and then the 'ok' button should be clicked to close the window.

However on playback the test selects the item but will not click the OK button, instead it hides the active modal window behind the application, making the whole app inactive.

I have tried several different recording methods in Ranorex to try and get round this with no luck.

Cheers
Chris

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

Re: modal window hidden instead of closed

Post by Support Team » Fri Nov 04, 2011 1:08 pm

Hi,

Do you have tried to call "Focus() or EnsureVisible()" before you click on the Button, because it seems that Ranorex loses the focus of the button?
repo.YourButton.Focus();
OR
repo.YourButton.EnsureVisible();
AND
repo.YourButton.Click();
You can also try to set the "Use Ensure Visible" property of your repository item to true.

Regards,
Markus
Ranorex Support Team
.
Image

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: modal window hidden instead of closed

Post by Chris Wright » Fri Nov 04, 2011 4:44 pm

Thanks for your responce.

I have been looking in the properties and cannot find 'use ensure visible'.
Can you tell me where I find this?

Thanks
Chris

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: modal window hidden instead of closed

Post by Chris Wright » Fri Nov 04, 2011 5:17 pm

Apologies, I have found this property now but unfortunately setting it to true does not solve the problem.

It actually looks like the replay is attempting to click the OK button on the window beneath rather than the OK button on the window in focus.

Cheers
Chris

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

Re: modal window hidden instead of closed

Post by Support Team » Mon Nov 07, 2011 12:27 pm

Hi,

have you tried to use the code Markus has mentioned in his last post:
Support Team wrote:
repo.YourButton.Focus();

//or

repo.YourButton.EnsureVisible();

//Before doing the Click Action:

repo.YourButton.Click();
Regards,
Tobias
Support Team
.
Image

Chris Wright
Posts: 25
Joined: Tue Mar 08, 2011 11:07 am

Re: modal window hidden instead of closed

Post by Chris Wright » Fri Nov 11, 2011 12:45 pm

Hi Tobias,

I haven't tried that code yet. Can you tell me which file its updated to please.

Is it the repository.rxrep?

Thanks
Chris

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

Re: modal window hidden instead of closed

Post by Support Team » Fri Nov 11, 2011 2:01 pm

Hi,

You can add a "User Code" to your Recording, just click on "Add New Action" and select "User Code". After you added a method name you can add these mentioned code to the specific created method in the "Recording1.UserCode.cs" file.

Regards,
Markus
Ranorex Support Team
.
Image