Exception getting while opening a firefox browser | Selenium C# Forum
Devesh Anand Posted on 24/02/2023


   I wrote a Simple code to open the Firefox browser but I am getting the exception...

Can you please help what I am doing the mistake...

The code that I have written in class

   class Program
        static void Main(string[] args)
            //Selenium 3.0
            FirefoxDriverService service = FirefoxDriverService.CreateDefaultService("D:\\Selenium with C# by Wizdom Technology\\Drivers", "geckodriver.exe");
            service.FirefoxBinaryPath = @"C:\Program Files (x86)\Mozilla Firefox\firefox.exe";
            FirefoxDriver driver = new FirefoxDriver(service);

Exception - System.ComponentModel.Win32Exception: 'The specified executable is not a valid application for this OS platform.'

Also i have  set the firefox.exe in the path...
Please help me where I am doing mistake...

Devesh Anand Replied on 24/02/2023


While running the application I am getting this exeption... What exception is this... Please help?


Responsive image

Raj Kishore Replied on 24/02/2023

What OS are you using?

Devesh Anand Replied on 24/02/2023

Hello Sir, 

     I am Using Windows 10 OS... And thankyou so much for your response sir...

Actually I resolve the Issue... The problem was with gecko driver version... 

I used driver with latest one with 64 bit and my firefox is also latest one... Hence it driver with browser matches perfectly and it worked...