Action 'close' failed on element
Posted: Thu Feb 21, 2013 12:03 am
Hi guys,
Just got done upgrading to 4.0.2.21666 from 3.1.0.13946.
On a line of code that has been used literally thousands of times with no issue, I am now receiving an unexpected exception. I know I can catch this exception myself, and probably will, but I use .CLOSE throughout my tests and am now concerned that I will have to visit the code of each of my tests to specifically add a specific try/catch for that specific exception.
Anything else you can suggest to mitigate this?
For reference, this was discussed as an issue in the past that was actually solved for me: http://www.ranorex.com/forum/closeappli ... t2727.html
Code:
HDJobPropertiesFormForm is just a standard Form that exists within my AUT. I am just calling the close method for this form.
The Exception:
Just got done upgrading to 4.0.2.21666 from 3.1.0.13946.
On a line of code that has been used literally thousands of times with no issue, I am now receiving an unexpected exception. I know I can catch this exception myself, and probably will, but I use .CLOSE throughout my tests and am now concerned that I will have to visit the code of each of my tests to specifically add a specific try/catch for that specific exception.
Anything else you can suggest to mitigate this?
For reference, this was discussed as an issue in the past that was actually solved for me: http://www.ranorex.com/forum/closeappli ... t2727.html
Code:
Code: Select all
//Wait for Start Page form to open
Ranorex.Form HDJobPropertiesFormForm = RFW.WaitForFormOfForm(HDClientForm, "JobPropertiesForm", 30);
if (HDJobPropertiesFormForm == null)
{
Report.Warn("Unable to open Library - Master Job properties Form. Cannot verify all forms will be in a maximized state.");
}
else
{
HDJobPropertiesFormForm.Activate();
HDJobPropertiesFormForm.Maximize();
Thread.Sleep(1000);
HDJobPropertiesFormForm.Close(); <THIS IS LINE 3081 THAT THROWS THE EXCEPTION
//Wait for the HDJobPropertiesFormForm to go away
WindowVisible = HDJobPropertiesFormForm.Visible;
while (WindowVisible == true)
{
Thread.Sleep(500);
WindowVisible = HDJobPropertiesFormForm.Visible;
}
Thread.Sleep(1000);
}
The Exception:
Code: Select all
Ranorex.ActionFailedException: Action 'close' failed on element '{Form:Job Properties - Library}'. ---> System.InvalidOperationException: Failed to get response from control within 2000 milliseconds.
at Ranorex.Plugin.WinFormsFlavorElement.InvokeMethod(BindingFlags flags, String name, Object[] args, Duration timeout)
at Ranorex.Plugin.WinFormsFlavorElement.InvokeMethod(BindingFlags flags, String name, Object[] args)
at Ranorex.Plugin.WinFormsFlavorElement.InvokeAction(Element element, String name, Object[] args)
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
--- End of inner exception stack trace ---
at Ranorex.Core.Element.InvokeAction(String name, Object[] args)
at Ranorex.Form.Close()
at RanorexFramework.RFW.HardDollarStartClient(String strHardDollarPath, String strJobToOpen, String strRemoteServerName) in C:\Documents and Settings\Admin\My Documents\Visual Studio 2008\Projects\RanorexFramework\RanorexFramework\Class1.cs:line 3081