6

I am trying to switch from FireFoxDriver to MarionetteDriver. I managed to run firefox with MarionetteDriver by running:

public void runMarionnete(){
    DesiredCapabilities dc = DesiredCapabilities.firefox();
    OSUtils.setProperty("webdriver.firefox.bin", "C:\\Firefox\\firefox.exe");
    OSUtils.setProperty("webdriver.gecko.driver","C:\\Drivers\\wires-0.6.2-win.exe"));
    _driver = new MarionetteDriver(dc);
}

But I have 2 things I am not sure how to do:

1.How to add XPI extensions to the driver ? in the old way I used: FirefoxProfile.addExtension ...

2.How to configure all the firefox properties , like I used to do , for example:

    profile.setPreference("browser.startup.homepage;about:home","about:blank");
    profile.setPreference("startup.homepage_welcome_url","about:blank");
    profile.setPreference("browser.usedOnWindows10.introURL","about:blank");
    profile.setPreference("devtools.devedition.promo.url","");
    profile.setPreference("xpinstall.signatures.required",false);

Thank you!

user3927203
  • 71
  • 1
  • 3

1 Answers1

3

You can use the same FirefoxProfile class, just add it to the DesiredCapabilities in the following way:

FirefoxProfile firefoxProfile = new FirefoxProfile();
firefoxProfile.setPreference("browser.startup.homepage;about:home","about:blank");
firefoxProfile.setPreference("startup.homepage_welcome_url","about:blank");
firefoxProfile.setPreference("browser.usedOnWindows10.introURL","about:blank");
firefoxProfile.setPreference("devtools.devedition.promo.url","");
firefoxProfile.setPreference("xpinstall.signatures.required",false);

DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
desiredCapabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
I_AM_PANDA
  • 532
  • 1
  • 4
  • 8
  • 3
    I wonder if there's any more to this. I tried adding to capabilities, but setting the download directory and auto download still didn't work for me. – JPhi1618 Oct 13 '16 at 18:34
  • I am also have trouble with the auto download--has there been an update to this? Here is my code: `fp = webdriver.FirefoxProfile()` `fp.set_preference("browser.download.folderList", 2) fp.set_preference("browser.download.manager.showWhenStarting",False) fp.set_preference("browser.download.dir", "H:\Downloads") fp.set_preference("browser.download.downloadDir","H:\Downloads") fp.set_preference("browser.download.defaultFolder","H:\Downloads")` `driver = webdriver.Firefox(capabilities=firefox_capabilities,firefox_binary=binary, firefox_profile = fp)` Am I missing something? – d84_n1nj4 Dec 30 '16 at 15:39
  • I came across this thread: [link](https://github.com/mozilla/geckodriver/issues/236) which eventually ends with this thread: [link](https://github.com/SeleniumHQ/selenium/issues/2572). The latter thread seems to be the most recent discussion on this matter. I asked how to update my code, and will make an update to this thread when it is figured it out. – d84_n1nj4 Dec 30 '16 at 16:49