Spy can find sub-form, but test stalls when trying to act.

Technology specific object identification, supported applications, web technologies, and 3rd party controls.
cnim
Posts: 4
Joined: Mon Jul 29, 2013 5:18 pm

Spy can find sub-form, but test stalls when trying to act.

Post by cnim » Mon Jul 29, 2013 5:37 pm

Windows 7 sp1
Ranorex Version 4.0.4.23593
.Net Runtime 4.0.30319.18052

I am automating an application that brings up another form window when you click on a button in the Main Application.

With Spy, I have been able to identify all of the elements in the sub-form. However, when I run the test (I write my tests in C#), ranorex hangs trying to act on the sub-form. It doesn't time out, it just hangs there. I've tried validating the sub-form, but the same thing happens, ranorex just hangs.

If I click Highlight in Spy, it highlights the elements with no problem.

Is there a reason that Ranorex would not timeout while trying to perform an action on an element?

A couple more pieces of info. In Spy, the sub-form is not a child of the main form, it's viewed as it's own form. Also, the main application goes into a not responding state when the sub-form is open.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Spy can find sub-form, but test stalls when trying to act.

Post by Ciege » Mon Jul 29, 2013 8:38 pm

What is your code for finding the new form? Since the new form is a child of the host and not of your AUT you need to root your find at the host level.
Also, the main application goes into a not responding state when the sub-form is open.
Whis may be the reason for the hang in Ranorex. If Ranorex is trying to query the AUT elements for the new form (if indeed you rooted your find at the form level) it *may* be that the AUT is not releasing control to Ranorex to be able to conduct the find?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

cnim
Posts: 4
Joined: Mon Jul 29, 2013 5:18 pm

Re: Spy can find sub-form, but test stalls when trying to act.

Post by cnim » Mon Jul 29, 2013 9:40 pm

Ranorex Spy doesn't show the sub-form as a child of the Main form (The form is nested directly below the Host). So I'm not sure if that's the issue.

One thing I just found out was that Ranorex is able to interact with the sub-form if the sub-form is open when I run the test. But if the test opens that sub-form, it is unable to interact with it. The same thing happens if I try to use the recorder.

I'm thinking that if necessary I can Create a 3 step test case to handle the window. Test Case 1 gets you to the sub-form. Test Case 2 manipulates sub-form. Test Case 3 would complete the test...Not ideal, but it would be workable.

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Spy can find sub-form, but test stalls when trying to act.

Post by Ciege » Mon Jul 29, 2013 11:08 pm

Again, can you share your snippet of code where you click the button from the main AUT then search for the new form?

Also, did you mark your main method with STAThread?
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

cnim
Posts: 4
Joined: Mon Jul 29, 2013 5:18 pm

Re: Spy can find sub-form, but test stalls when trying to act.

Post by cnim » Tue Jul 30, 2013 4:07 pm

I'm not sure if this code is what you are looking for. The first line is interacting with the main application form, the 2nd is a right-click menu, the 3rd is a pop up dialog message box. After that the CreateTemporaryOrder sub-form comes up, the last 2 lines are trying to interact with that sub-form.

Code: Select all

            rano.RWMain.StudyBrowserSearchCriteria.PatientNameRow0.Click(System.Windows.Forms.MouseButtons.Right);
            rano.ContextMenuStripRISAdd.DictateFirstSelectedAndQueueRemain.Click();
            rano.Message.ButtonOK.Click();

            repo.CreateTemporaryOrder.Code.PressKeys("11111111");
            repo.CreateTemporaryOrder.Code.DoubleClick("27;6");
I'm not sure this is the code you are looking for. Do you also need to look at the Repository.cs that was created as well?

Thanks for the help.

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

Re: Spy can find sub-form, but test stalls when trying to act.

Post by Support Team » Thu Aug 01, 2013 4:14 pm

Hello,

Could you please try to add a short delay (e.g. 500ms) before you access your sub-form?
Do you see any difference?

Regards,
Markus (T)
.
Image

cnim
Posts: 4
Joined: Mon Jul 29, 2013 5:18 pm

Re: Spy can find sub-form, but test stalls when trying to act.

Post by cnim » Fri Aug 02, 2013 5:54 pm

Support Team wrote:Hello,

Could you please try to add a short delay (e.g. 500ms) before you access your sub-form?
Do you see any difference?

Regards,
Markus (T)
That worked! I can't believe I didn't throw in a thead.sleep into my code when I was trying to get it to work. It's just that there was no delay in the sub-form coming up, and nothing timed out in the code.

Thanks,
Cnim

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

Re: Spy can find sub-form, but test stalls when trying to act.

Post by Support Team » Mon Aug 05, 2013 2:44 pm

Hello,

That sounds good :-)

Regards,
Markus (T)
.
Image