Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Migrating from Firefox WebDriver to Marionette

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!

like image 329
user3927203 Avatar asked May 04 '16 13:05

user3927203


1 Answers

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);
like image 132
I_AM_PANDA Avatar answered Oct 23 '22 07:10

I_AM_PANDA