Search Here!

Saturday, February 16, 2013

Webdriver Handling IEdriver.exe path of 32/64 bit machine

Webdriver handling IEdriver.exe for 32 Bit and 64 bit machine. Now, we don’t need to bother to change every time the path for IEdriver.exe for 32/64 bit machine. Just add the below code and keep both IEdriver.exe file in a folder and it would automatically choose according to machine configuration.

String processorArchitecture = Microsoft.Win32.Registry.GetValue(
                "HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Session Manager\\Environment"
                , "PROCESSOR_ARCHITECTURE", null).ToString();

            string ieDriverPath =
                (Path.GetDirectoryName(
                System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
                + "\\..\\..\\..\\..\\ExternalAssemblies\\" + ((processorArchitecture == "x86") ? "x86" : "x64")).Replace("file:\\", "");

No comments:

Post a Comment