Forum Discussion

sadhwani's avatar
sadhwani
New Contributor
13 years ago

Better way of finding the correct instance of IE in the .NET code.

In TestComplete, we have code like this:   

dim ieaid : set ieaid = dotNet.AutomationLibrary.IEAid.zctor(sServer)


                               

That sServer is then passed into the .NET dll and used here:


 


public IEAid(string location)


        {


            foreach (InternetExplorer ieIter in new ShellWindows())


            {


                if (ieIter.LocationURL.Contains(location) && ieIter.Visible)


                {


 


This code is looking for an instance of Internet Explorer where the URL contains the string found in the <Server> element in the BillOfGoods file.  This approach doesn’t work in a distributed environment because the browser is redirected to a different server. So to fix this l need to find a better way of finding the correct instance of IE in the .NET code.



Any help on this will definately be appriciated.




Thanks

Ashish

1 Reply

  • Julia_K's avatar
    Julia_K
    SmartBear Alumni (Retired)

    Hello Ashish,


    You had better consult the developers of your DLL to decide which approach to search for the needed Internet Explorer instance suits your needs best.


    Still, please note that TestComplete has its own functionality that can be used to search for the specified Internet Explorer instance. For example, you can explore the Internet Explorer processes displayed in the Object Browser to find which instance contains the needed URL.


    Also, please pay attention to the Internet Explorer ver. 8 section of the Web Testing and Tabbed Browsers tech paper that instructs how to disable Loosely Coupled Internet Explorer preventing it from launching several instances of itself. I hope, you find this information useful.


    Good luck.