Exception of type 'System.ArgumentException'

May 7, 2009 at 11:11 AM
I had written the following function to open an Application.
Its working fine for calc, winword but for iexplore its throwing an Exception of type 'System.ArgumentException' was thrown.

public static AutomationElement LaunchApplication(string fileName, string arguments)
            Process process = new Process();
            process.StartInfo.FileName = fileName;
            process.StartInfo.Arguments = arguments;
            // Procss is exited for pnagent.exe so the requested information doesnt not exist.There shoudl
            //be some other way to get the automation Element

            return (AutomationElement.FromHandle(process.MainWindowHandle)); *** Exception****

Any help ?