Search code examples
seleniumfirefoxfirefox-marionette

Selenium - Using Portable Firefox 48 with Marionette Driver


how is it possible to use marionetteDriver with a FF 48 portable? I know how it works with installed Firefox 48:

String marionetteDriverLocation = getClass().getClassLoader().getResource("[PATH_TO_GECKODRIVER]/wires.exe").getPath();
System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
WebDriver driver = new MarionetteDriver(createDefaultCapabilitiesFirefox());

and firefox portable up to 46:

FirefoxBinary binary = new FirefoxBinary(new File(firefoxPortablePath));
WebDriver driver = new FirefoxDriver(binary, createFirefoxProfile(),createDefaultCapabilitiesFirefox());

But what do I have to do when i'd like to use a portable Firefox 48?


Solution

  • Try same as you are using for 46. Only changes is just use setCapability("marionette", true); into DesiredCapabilities as below :-

    String marionetteDriverLocation = getClass().getClassLoader().getResource("[PATH_TO_GECKODRIVER]/wires.exe").getPath();
    System.setProperty("webdriver.gecko.driver", marionetteDriverLocation);
    
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setCapability("marionette", true);
    
    FirefoxBinary binary = new FirefoxBinary(new File(firefoxPortablePath));
    
    WebDriver driver = new FirefoxDriver(binary, createFirefoxProfile(), capabilities);