/// <summary>
        /// Initializes the executable path to FireFox using the registry.
        /// </summary>
        /// <param name="mozillaKey">The mozilla key.</param>
        public static string GetExecutablePathUsingRegistry(RegistryKey mozillaKey)
        {
            var currentVersion = (string)mozillaKey.GetValue("CurrentVersion");

            if (string.IsNullOrEmpty(currentVersion))
            {
                throw FireFoxException.FireFoxNotInstalled();
            }

            var currentMain = mozillaKey.OpenSubKey(string.Format(@"{0}\Main", currentVersion));

            if (currentMain == null)
            {
                throw FireFoxException.FireFoxNotInstalled();
            }

            var path = (string)currentMain.GetValue("PathToExe");

            if (!File.Exists(path))
            {
                throw new FireFoxException(
                          "FireFox executable listed in the registry does not exist, please make sure you have installed FireFox and MozRepl correctly");
            }

            return(path);
        }
        /// <summary>
        /// Initalizes the executable path.
        /// </summary>
        public static string GetExecutablePath()
        {
            string path;
            var    mozillaKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Mozilla\Mozilla Firefox");

            if (mozillaKey != null)
            {
                path = GetExecutablePathUsingRegistry(mozillaKey);
            }
            else
            {
                // We try and guess common locations where FireFox might be installed
                var tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"Mozilla FireFox\FireFox.exe");
                if (File.Exists(tempPath))
                {
                    path = tempPath;
                }
                else
                {
                    tempPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + " (x86)", @"Mozilla FireFox\FireFox.exe");
                    if (File.Exists(tempPath))
                    {
                        path = tempPath;
                    }
                    else
                    {
                        throw FireFoxException.FireFoxNotInstalled();
                    }
                }
            }

            return(path);
        }