Search code examples
c#seleniumselenium-webdriverselenium-firefoxdriverportable-applications

Can I control selenium with firefox portable?


I have read a lot of articles related to using selenium and portable firefox. But the code doesn't work with me. Did I do something wrong? I am using firefox portable 67 and Geckodriver v0.24.0.

FirefoxDriverService driverService = FirefoxDriverService.CreateDefaultService(@"D:\C# Project\FirefoxPortal tesst\FirefoxPortal tesst\bin\Debug\", "geckodriver.exe");
            FirefoxOptions options = new FirefoxOptions();
            //var profile = new FirefoxProfileManager().GetProfile("");
            options.Profile = new FirefoxProfile(@"D:\C# Project\FirefoxPortal tesst\FirefoxPortal tesst\bin\Debug\FirefoxPortable\Data\profile");
            options.BrowserExecutableLocation = @"D:\C# Project\FirefoxPortal tesst\FirefoxPortal tesst\bin\Debug\FirefoxPortable\FirefoxPortable.exe";
            IWebDriver driver = new FirefoxDriver(driverService, options);
            driver.Navigate().GoToUrl("https://stackoverflow.com/");


Solution

  • I do not have time today but try changing

    options.BrowserExecutableLocation = @"D:\C# Project\FirefoxPortal tesst\FirefoxPortal tesst\bin\Debug\FirefoxPortable\FirefoxPortable.exe";
    

    to

    options.BrowserExecutableLocation = @"D:\C# Project\FirefoxPortal tesst\FirefoxPortal tesst\bin\Debug\FirefoxPortable\App\firefox64\firefox.exe";
    

    or to wherever you have your firefox.exe file.