Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bypass the firefox update page when using Selenium?

I have some selenium tests running on Firefox browser. unfortunatly, although I take care to create a new profile, I always have the /firstrun/ page of Firefox showing up when my test start, which is rather annoying, since that page gets it content over the web.

I've tried disabling it the following way

    FirefoxProfile profile = new FirefoxProfile(profileDir);
    if(!exists) {
        profile.setPreference("signed.applets.codebase_principal_support", true);
        profile.setPreference("capability.principal.codebase.p0.granted", true);
        profile.setPreference("startup.homepage_override_url", "about:blank");
        profile.setPreference("browser.startup.homepage_override.mstone", "'ignore'");

but it stills shows up.

What can I do to make sure Firefox starts with no page shown ?

like image 542
Riduidel Avatar asked Nov 09 '22 00:11

Riduidel


1 Answers

Kiril asks the right question - "Why the single quotes?". Without it works for me.

 profile.setPreference("browser.startup.homepage_override.mstone", "ignore");

An alternative approach is to load the blank page after the Firefox instance has been created (driver.get("about:blank");)

like image 61
Hubert Avatar answered Nov 14 '22 22:11

Hubert