Hi guys,
We're using Telerik Testing Framework for automation and running tests primarily against IE browser and since we have security policies enforced on clients, tests started to fail more often with ApplicationException on start.
After some investigation we found that in LaunchNewBrowserInstance() function in Core.Manager has hardcoded timeout to 5000, which is not enough now for IE to respond. As you can see in the code below, everything is using 'timeout' variable except 'Connector.Attach(ref handle, 5000);' - it uses hardcoded timeout to wait:
internal static object LaunchNewBrowserInstance(
int timeout,
ProcessWindowStyle windowStyle,
string pipename,
string url)
{
string str = string.IsNullOrEmpty(url) ? "about:blank" : url;
try
{
ProcessStartInfo startInfo = new ProcessStartInfo()
{
Arguments = (InternetExplorerActions.MajorVersion >= 8 ? "-nomerge " : string.Empty) + str,
Verb = "open",
WindowStyle = windowStyle,
ErrorDialog = false,
FileName = "iexplore.exe"
};
System.Diagnostics.Process process = System.Diagnostics.Process.Start(startInfo);
TraceInfo.Framework.ReportProcessLaunched(process, startInfo);
IntPtr handle = InternetExplorerActions.WaitForIEFrameFromProcess(process, timeout);
TraceInfo.Framework.WriteLine("Attempting to attach on IE frame (HWND={0})...", (object) handle);
Connector.Attach(ref handle, 5000);
System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
int num = currentProcess.Id;
if (currentProcess.ProcessName == "ArtOfTest.Runner")
num = InternetExplorerActions.SafeGetParentOrCurrentId(currentProcess);
Connector.InjectCode(handle, InternetExplorerActions.ArtOfTestPlugin, pipename, num.ToString(), true, timeout, "");
return (object) null;
}
catch (Exception ex)
{
throw new ApplicationException("Exception thrown attempting to launch Internet Explorer. Please make sure Internet Explorer is properly installed and you are able to launch it.", ex);
}
}
This is likely the cause, why our increased timeout settings are ignored and test fails shortly after start, even if we increase timeouts significantly. Visually, it looks like IE is doing some background job and is not responsive for some period of time and 5 seconds is not enough to wait. So, could you change the code to respect 'timeout' instead of using constant number?
We've been using Telerik Testing Framework for a long time already and from time to time had this issue, but workaround it by catching exception, killing browser and trying to launch it again. But now that trick is not helping anymore, the majority of tests fails with this exception on start.
This fix is really simple and will save us a lot of time, trying to invent some new solution to make IE more responsive on start.
Thanks,
Oleksii