Under Review
Last Updated: 07 May 2020 10:39 by ADMIN
madnut
Created on: 29 Apr 2020 14:22
Type: Feature Request
0
[Telerik Framework] ApplicationException is thrown when Telerik tries to start IE browser on heavy/slow clients

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

5 comments
ADMIN
Elena
Posted on: 07 May 2020 10:39

Hello Oleksii,

I am glad to know you managed to download the installer file this time. Please, take your time to test the build and when you have your observations, get back to us and share these. 

Regards,
Elena
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
madnut
Posted on: 06 May 2020 11:24

Hi Elena, now everything is fine with the link, we have downloaded installer and will verify it on our agents. It will require some time to check, so will let you know the results in couple weeks or so.

Thanks,

Oleksii

ADMIN
Elena
Posted on: 05 May 2020 13:16

Hi Oleksii,

I re-uploaded the installation file. Can you, please, check if you can download it now?

Regards,
Elena
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
madnut
Posted on: 05 May 2020 09:22

Hi Elena, thanks for the custom build - however, when we tried to download it, we got msi file of 0 bytes size. Could you check from your side, looks like permission issue or broken package?

Thanks,

Oleksii

ADMIN
Elena
Posted on: 04 May 2020 16:44

Hi Oleksii,

Thank you for the thorough information of your findings. 

The issue was initially investigated by the development team and it turns out that the misbehavior you identified is caused by a piece of some old code in the Testing Framework. 

Although, we didn't have the chance to reproduce the misbehavior on our end, due to the lack of such slow machine, we prepared a build with a possible change in regards the usage of that piece of code. So far, we cannot commit officially that the current behavior will be permanently changed as we need to validate it in further depth. Though, you can test in your end and share your observations for the outcome. 

So, please, find the installation file in this cloud folder and take the time to test it on the slow environment you have available. I will appreciate if you get back to us and elaborate on the test runs with that build. Please, note that this is a custom change on top of our current product version.

Thank you in advance.

Regards,
Elena
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.