Example usage for org.openqa.selenium.firefox FirefoxDriver PROFILE

List of usage examples for org.openqa.selenium.firefox FirefoxDriver PROFILE

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxDriver PROFILE.

Prototype

String PROFILE

To view the source code for org.openqa.selenium.firefox FirefoxDriver PROFILE.

Click Source Link

Usage

From source file:info.magnolia.integrationtests.uitest.AbstractMagnoliaUITest.java

License:Open Source License

/**
 * Returns a new {@link WebDriver} to be used for all tests.
 *
 * If a system property {@link #SELENIUM_SERVER_HOST_NAME} was provided with a hostname a {@link RemoteWebDriver} will be
 * returned, otherwise the default {@link FirefoxDriver}.
 *//*from  ww w  .jav  a2 s. com*/
protected WebDriver getNewWebDriver() {
    // Set the download dir which might be overwritten in subclasses
    firefoxProfile.setPreference("browser.download.dir", getDownloadDir());

    // Set our custom profile as desired capabilities
    capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);

    // If a vmHostName was supplied then we're executing the tests in a Virtual Machine
    String vmHostName = System.getProperty(SELENIUM_SERVER_HOST_NAME);
    if (StringUtils.isNotBlank(vmHostName)) {
        try {
            URL seleniumServerUrl = new URL(String.format("http://%s:4444/wd/hub", vmHostName));
            return new RemoteWebDriver(seleniumServerUrl, capabilities);
        } catch (MalformedURLException e) {
            log.error("VM hostname was set [{}] but couldn't setup URL", vmHostName, e);
        }
    }

    return new FirefoxDriver(capabilities);
}

From source file:io.github.bonigarcia.wdm.test.RemoteWebRtcFirefoxTest.java

License:Apache License

@Before
public void setupTest() throws MalformedURLException {
    DesiredCapabilities capability = DesiredCapabilities.firefox();
    FirefoxProfile profile = new FirefoxProfile();
    profile.setPreference("media.navigator.permission.disabled", true);
    profile.setPreference("media.navigator.streams.fake", true);
    capability.setCapability(FirefoxDriver.PROFILE, profile);
    driver = new RemoteWebDriver(new URL("http://localhost:4444/wd/hub"), capability);
}

From source file:io.openvidu.test.browsers.FirefoxUser.java

License:Apache License

public FirefoxUser(String userName, int timeOfWaitInSeconds) {
    super(userName, timeOfWaitInSeconds);

    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    capabilities.setAcceptInsecureCerts(true);
    capabilities.setCapability(CapabilityType.UNEXPECTED_ALERT_BEHAVIOUR, UnexpectedAlertBehaviour.IGNORE);
    FirefoxProfile profile = new FirefoxProfile();

    // This flag avoids granting the access to the camera
    profile.setPreference("media.navigator.permission.disabled", true);
    // This flag force to use fake user media (synthetic video of multiple color)
    profile.setPreference("media.navigator.streams.fake", true);

    capabilities.setCapability(FirefoxDriver.PROFILE, profile);

    String REMOTE_URL = System.getProperty("REMOTE_URL_FIREFOX");
    if (REMOTE_URL != null) {
        log.info("Using URL {} to connect to remote web driver", REMOTE_URL);
        try {/*  w w  w . j  a  va2 s.c o  m*/
            this.driver = new RemoteWebDriver(new URL(REMOTE_URL), capabilities);
        } catch (MalformedURLException e) {
            e.printStackTrace();
        }
    } else {
        log.info("Using local web driver");
        this.driver = new FirefoxDriver(capabilities);
    }

    this.configureDriver();
}

From source file:io.wcm.qa.galenium.webdriver.WebDriverManager.java

License:Apache License

private DesiredCapabilities getDesiredCapabilities(TestDevice newTestDevice) {
    DesiredCapabilities capabilities;//from  w ww  .java2  s . c o  m

    GaleniumReportUtil.getLogger().info("Getting capabilities for " + newTestDevice.getBrowserType());
    switch (newTestDevice.getBrowserType()) {
    case CHROME:
        capabilities = DesiredCapabilities.chrome();
        String chromeEmulator = newTestDevice.getChromeEmulator();
        if (chromeEmulator != null) {
            Map<String, String> mobileEmulation = new HashMap<String, String>();
            mobileEmulation.put("deviceName", chromeEmulator);
            Map<String, Object> chromeOptions = new HashMap<String, Object>();
            chromeOptions.put("mobileEmulation", mobileEmulation);
            capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
        }

        break;

    case IE:
        capabilities = DesiredCapabilities.internetExplorer();
        break;

    case SAFARI:
        capabilities = DesiredCapabilities.safari();
        break;

    case PHANTOMJS:
        capabilities = DesiredCapabilities.phantomjs();
        capabilities.setCapability(PhantomJSDriverService.PHANTOMJS_CLI_ARGS,
                new String[] { "--ignore-ssl-errors=true", "--ssl-protocol=tlsv1", "--web-security=false",
                        "--webdriver-loglevel=OFF", "--webdriver-loglevel=NONE" });
        break;

    default:
    case FIREFOX:
        capabilities = DesiredCapabilities.firefox();
        if (firefoxProfile == null) {
            firefoxProfile = new FirefoxProfile();
            // Workaround for click events spuriously failing in Firefox (https://code.google.com/p/selenium/issues/detail?id=6112)
            firefoxProfile.setEnableNativeEvents(false);
            firefoxProfile.setAcceptUntrustedCertificates(true);
            firefoxProfile.setAssumeUntrustedCertificateIssuer(false);
        }
        capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
        break;
    }

    // Request browser logging capabilities for capturing console.log output
    LoggingPreferences loggingPrefs = new LoggingPreferences();
    loggingPrefs.enable(LogType.BROWSER, Level.INFO);
    capabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPrefs);
    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

    GaleniumReportUtil.getLogger().info("Done generating capabilities");
    return capabilities;
}

From source file:net.continuumsecurity.web.drivers.DriverFactory.java

License:Open Source License

public WebDriver createFirefoxDriver(DesiredCapabilities capabilities) {

    if (capabilities != null) {
        return new FirefoxDriver(capabilities);
    }//  www . ja  v a  2  s. c  om

    ProfilesIni allProfiles = new ProfilesIni();
    FirefoxProfile myProfile = allProfiles.getProfile("WebDriver");
    if (myProfile == null) {
        File ffDir = new File(System.getProperty("user.dir") + File.separator + "ffProfile");
        if (!ffDir.exists()) {
            ffDir.mkdir();
        }
        myProfile = new FirefoxProfile(ffDir);
    }
    myProfile.setAcceptUntrustedCertificates(true);
    myProfile.setAssumeUntrustedCertificateIssuer(true);
    myProfile.setPreference("webdriver.load.strategy", "unstable");
    if (capabilities == null) {
        capabilities = new DesiredCapabilities();
    }
    capabilities.setCapability(FirefoxDriver.PROFILE, myProfile);
    return new FirefoxDriver(capabilities);

}

From source file:org.alfresco.grid.WebDriverFactory.java

License:Open Source License

public WebDriver getObject(Browser browser) {
    switch (browser) {
    case FireFox:
        return getFireFox(false);
    case Chrome:/*from  w w w  .  ja v a 2  s .co  m*/
        return getChromeDriver();
    case HtmlUnit:
        return new HtmlUnitDriver(true);
    case IE:
        return getInternetExplorerDriver();
    case Safari:
        return getSafariDriver();
    case RemoteFireFox:
        DesiredCapabilities capabilities = new DesiredCapabilities();
        capabilities.setBrowserName(BrowserType.FIREFOX);
        capabilities.setJavascriptEnabled(true);
        FirefoxProfile profile = createProfile();
        //The below two preferences added to disable the firefox auto update
        profile.setPreference("app.update.auto", false);
        profile.setPreference("app.update.enabled", false);
        profile.setEnableNativeEvents(true);
        capabilities.setCapability(FirefoxDriver.PROFILE, profile);
        return getRemoteDriver(capabilities);
    case RemoteChrome:
        DesiredCapabilities chromeCapabilities = DesiredCapabilities.chrome();
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--kiosk");
        chromeCapabilities.setCapability(ChromeOptions.CAPABILITY, options);
        return getRemoteDriver(chromeCapabilities);
    case RemoteIE:
        DesiredCapabilities ieCapabilities = DesiredCapabilities.internetExplorer();
        ieCapabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                true);
        return getRemoteDriver(ieCapabilities);
    case FireFoxDownloadToDir:
        return getFireFox(true);
    default:
        throw new IllegalArgumentException("Invalid browser specified");
    }
}

From source file:org.alfresco.grid.WebDriverFactory.java

License:Open Source License

/**
 * Creates a new instance of an {@link FirefoxDriver} 
 * @param boolean with a specific profile or false for default FireFox
 * @return {@link DesiredCapabilities} type of browser capability 
 * @throws UnsupportedOperationException if grid url is invalid
 *//*w  w w .  j  a  va 2 s.c om*/
private FirefoxDriver getFireFox(boolean customProfile) {
    DesiredCapabilities capabilities = DesiredCapabilities.firefox();
    FirefoxProfile firefoxProfile = createProfile();
    //The below two preferences added to disable the firefox auto update
    firefoxProfile.setPreference("app.update.auto", false);
    firefoxProfile.setPreference("app.update.enabled", false);
    firefoxProfile.setEnableNativeEvents(true);
    if (customProfile) {
        firefoxProfile.setPreference("browser.download.folderList", 2);
        firefoxProfile.setPreference("browser.download.dir", downloadDirectory);
        firefoxProfile.setPreference("browser.helperApps.neverAsk.saveToDisk", mimeTypes);

    }
    if (preferences != null && preferences.size() > 0) {
        Set<BrowserPreference> preferenceSet = preferences.keySet();
        for (BrowserPreference browserPreference : preferenceSet) {
            if (BrowserPreference.Language.equals(browserPreference)) {
                firefoxProfile.setPreference(browserPreference.getFireFoxKey(),
                        formatLocale((Locale) preferences.get(browserPreference)));
            } else {
                if (BrowserPreference.DownloadFolderList.equals(browserPreference)) {
                    firefoxProfile.setPreference(browserPreference.getFireFoxKey(),
                            Integer.valueOf((String) preferences.get(browserPreference)));
                } else {
                    firefoxProfile.setPreference(browserPreference.getFireFoxKey(),
                            (String) preferences.get(browserPreference));
                }
            }
        }
    }
    capabilities.setCapability(FirefoxDriver.PROFILE, firefoxProfile);
    return new FirefoxDriver(capabilities);
}

From source file:org.cerberus.engine.execution.impl.SeleniumServerService.java

License:Open Source License

/**
 * Instanciate DesiredCapabilities regarding the browser
 * @param capabilities/*from   ww  w  . j ava 2s  . com*/
 * @param browser
 * @param tCExecution
 * @return
 * @throws CerberusException
 */
private DesiredCapabilities setCapabilityBrowser(DesiredCapabilities capabilities, String browser,
        TestCaseExecution tCExecution) throws CerberusException {
    try {
        if (browser.equalsIgnoreCase("firefox")) {
            capabilities = DesiredCapabilities.firefox();
            FirefoxProfile profile = new FirefoxProfile();
            profile.setAcceptUntrustedCertificates(true);
            profile.setAssumeUntrustedCertificateIssuer(true);
            profile.setPreference("app.update.enabled", false);
            profile.setEnableNativeEvents(true);
            try {
                Invariant invariant = this.invariantService.findInvariantByIdValue("COUNTRY",
                        tCExecution.getCountry());
                if (invariant.getGp2() == null) {
                    LOG.warn("Country selected (" + tCExecution.getCountry()
                            + ") has no value of GP2 in Invariant table, default language set to English (en)");
                    profile.setPreference("intl.accept_languages", "en");
                } else {
                    profile.setPreference("intl.accept_languages", invariant.getGp2());
                }
            } catch (CerberusException ex) {
                LOG.warn("Country selected (" + tCExecution.getCountry()
                        + ") not in Invariant table, default language set to English (en)");
                profile.setPreference("intl.accept_languages", "en");
            }

            capabilities.setCapability("acceptInsecureCerts", true);
            capabilities.setCapability("acceptSslCerts", true);
            //capabilities.setCapability("marionette", true);
            capabilities.setCapability(FirefoxDriver.PROFILE, profile);
        } else if (browser.equalsIgnoreCase("IE")) {
            capabilities = DesiredCapabilities.internetExplorer();
        } else if (browser.equalsIgnoreCase("chrome")) {
            capabilities = DesiredCapabilities.chrome();
        } else if (browser.contains("android")) {
            capabilities = DesiredCapabilities.android();
        } else if (browser.contains("ipad")) {
            capabilities = DesiredCapabilities.ipad();
        } else if (browser.contains("iphone")) {
            capabilities = DesiredCapabilities.iphone();
        } else if (browser.contains("opera")) {
            capabilities = DesiredCapabilities.opera();
        } else if (browser.contains("safari")) {
            capabilities = DesiredCapabilities.safari();
        } else {
            LOG.warn("Not supported Browser : " + browser);
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(
                    mes.getDescription().replace("%MES%", "Browser '" + browser + "' is not supported"));
            mes.setDescription("Not supported Browser : " + browser);
            throw new CerberusException(mes);
        }
    } catch (CerberusException ex) {
        MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
        mes.setDescription(mes.getDescription().replace("%MES%", "Failed to set capability on the browser '"
                + browser + "' due to " + ex.getMessageError().getDescription()));
        throw new CerberusException(mes);
    }
    return capabilities;
}

From source file:org.cerberus.service.engine.impl.SeleniumServerService.java

License:Open Source License

private DesiredCapabilities setFirefoxProfile(TestCaseExecution tCExecution) throws CerberusException {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    profile.setAcceptUntrustedCertificates(true);
    profile.setPreference("network.http.connection-timeout", "300");

    try {/*from w  w  w . j a  v a 2  s.c o m*/
        Invariant invariant = this.invariantService.findInvariantByIdValue("COUNTRY", tCExecution.getCountry());
        if (invariant.getGp2() == null) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Country selected (" + tCExecution.getCountry()
                    + ") has no value of GP2 in Invariant table, default language set to English(en)");
            profile.setPreference("intl.accept_languages", "en");
        } else {
            profile.setPreference("intl.accept_languages", invariant.getGp2());
        }
    } catch (CerberusException ex) {
        MyLogger.log(Selenium.class.getName(), Level.WARN, "Country selected (" + tCExecution.getCountry()
                + ") not in Invariant table, default language set to English(en)");
        profile.setPreference("intl.accept_languages", "en");
    }

    if (tCExecution.getVerbose() > 0) {
        String firebugPath = parameterService
                .findParameterByKey("cerberus_selenium_firefoxextension_firebug", "").getValue();
        String netexportPath = parameterService
                .findParameterByKey("cerberus_selenium_firefoxextension_netexport", "").getValue();
        if (StringUtil.isNullOrEmpty(firebugPath)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_selenium_firefoxextension_firebug' not defined."));
            throw new CerberusException(mes);
        }
        if (StringUtil.isNullOrEmpty(netexportPath)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_selenium_firefoxextension_netexport' not defined."));
            throw new CerberusException(mes);
        }

        File firebug = new File(firebugPath);
        if (!firebug.canRead()) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Can't read : " + firebugPath);
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : '" + firebugPath
                    + "' Change the Cerberus parameter : cerberus_selenium_firefoxextension_firebug"));
            throw new CerberusException(mes);

        }
        try {
            MyLogger.log(SeleniumServerService.class.getName(), Level.DEBUG,
                    "Adding firebug extension : " + firebugPath);
            profile.addExtension(firebug);
        } catch (IOException exception) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, exception.toString());
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + firebugPath));
            throw new CerberusException(mes);
        }

        File netExport = new File(netexportPath);
        if (!netExport.canRead()) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Can't read : " + netexportPath);
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + netexportPath
                    + "' Change the Cerberus parameter : cerberus_selenium_firefoxextension_netexport"));
            throw new CerberusException(mes);
        }
        try {
            MyLogger.log(SeleniumServerService.class.getName(), Level.DEBUG,
                    "Adding netexport extension : " + netexportPath);
            profile.addExtension(netExport);
        } catch (IOException exception) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, exception.toString());
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + netexportPath));
            throw new CerberusException(mes);
        }

        String cerberusUrl = parameterService.findParameterByKey("cerberus_url", "").getValue();
        if (StringUtil.isNullOrEmpty(cerberusUrl)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_url' not defined."));
            throw new CerberusException(mes);
        }

        // Set default Firefox preferences
        profile.setPreference("app.update.enabled", false);

        // Set default Firebug preferences
        profile.setPreference("extensions.firebug.currentVersion", "1.11.4");
        profile.setPreference("extensions.firebug.allPagesActivation", "on");
        profile.setPreference("extensions.firebug.defaultPanelName", "net");
        profile.setPreference("extensions.firebug.net.enableSites", true);

        // Set default NetExport preferences
        profile.setPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);
        // Export to Server.
        String url = cerberusUrl + "/SaveStatistic?logId=" + tCExecution.getExecutionUUID();
        profile.setPreference("extensions.firebug.netexport.autoExportToServer", true);
        profile.setPreference("extensions.firebug.netexport.beaconServerURL", url);
        MyLogger.log(SeleniumServerService.class.getName(), Level.DEBUG,
                "Selenium netexport.beaconServerURL : " + url);
        profile.setPreference("extensions.firebug.netexport.sendToConfirmation", false);
        profile.setPreference("extensions.firebug.netexport.showPreview", false);

    }

    //if userAgent
    if (!("").equals(tCExecution.getUserAgent())) {
        profile.setPreference("general.useragent.override", tCExecution.getUserAgent());
    }

    DesiredCapabilities dc = DesiredCapabilities.firefox();
    dc.setCapability(FirefoxDriver.PROFILE, profile);

    return dc;
}

From source file:org.cerberus.serviceEngine.impl.SeleniumService.java

License:Open Source License

private DesiredCapabilities setFirefoxProfile(String executionUUID, boolean record, String country)
        throws CerberusException {
    FirefoxProfile profile = new FirefoxProfile();
    profile.setEnableNativeEvents(true);
    profile.setAcceptUntrustedCertificates(true);
    profile.setPreference("network.http.connection-timeout", "300");

    try {/*from   w  w  w .ja  va  2s  .  c  o  m*/
        Invariant invariant = this.invariantService.findInvariantByIdValue("COUNTRY", country);
        if (invariant.getGp2() == null) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Country selected (" + country
                    + ") has no value of GP2 in Invariant table, default language set to English(en)");
            profile.setPreference("intl.accept_languages", "en");
        } else {
            profile.setPreference("intl.accept_languages", invariant.getGp2());
        }
    } catch (CerberusException ex) {
        MyLogger.log(Selenium.class.getName(), Level.WARN, "Country selected (" + country
                + ") not in Invariant table, default language set to English(en)");
        profile.setPreference("intl.accept_languages", "en");
    }

    if (record) {
        String firebugPath = parameterService
                .findParameterByKey("cerberus_selenium_firefoxextension_firebug", "").getValue();
        String netexportPath = parameterService
                .findParameterByKey("cerberus_selenium_firefoxextension_netexport", "").getValue();
        if (StringUtil.isNullOrEmpty(firebugPath)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_selenium_firefoxextension_firebug' not defined."));
            throw new CerberusException(mes);
        }
        if (StringUtil.isNullOrEmpty(netexportPath)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_selenium_firefoxextension_netexport' not defined."));
            throw new CerberusException(mes);
        }

        File firebug = new File(firebugPath);
        if (!firebug.canRead()) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Can't read : " + firebugPath);
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : '" + firebugPath
                    + "' Change the Cerberus parameter : cerberus_selenium_firefoxextension_firebug"));
            throw new CerberusException(mes);

        }
        try {
            MyLogger.log(SeleniumService.class.getName(), Level.DEBUG,
                    "Adding firebug extension : " + firebugPath);
            profile.addExtension(firebug);
        } catch (IOException exception) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, exception.toString());
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + firebugPath));
            throw new CerberusException(mes);
        }

        File netExport = new File(netexportPath);
        if (!netExport.canRead()) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, "Can't read : " + netexportPath);
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + netexportPath
                    + "' Change the Cerberus parameter : cerberus_selenium_firefoxextension_netexport"));
            throw new CerberusException(mes);
        }
        try {
            MyLogger.log(SeleniumService.class.getName(), Level.DEBUG,
                    "Adding netexport extension : " + netexportPath);
            profile.addExtension(netExport);
        } catch (IOException exception) {
            MyLogger.log(Selenium.class.getName(), Level.WARN, exception.toString());
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%", "File not found : " + netexportPath));
            throw new CerberusException(mes);
        }

        String cerberusUrl = parameterService.findParameterByKey("cerberus_url", "").getValue();
        if (StringUtil.isNullOrEmpty(cerberusUrl)) {
            MessageGeneral mes = new MessageGeneral(MessageGeneralEnum.EXECUTION_FA_SELENIUM);
            mes.setDescription(mes.getDescription().replaceAll("%MES%",
                    "Mandatory parameter for network traffic 'cerberus_url' not defined."));
            throw new CerberusException(mes);
        }

        // Set default Firefox preferences
        profile.setPreference("app.update.enabled", false);

        // Set default Firebug preferences
        profile.setPreference("extensions.firebug.currentVersion", "1.11.4");
        profile.setPreference("extensions.firebug.allPagesActivation", "on");
        profile.setPreference("extensions.firebug.defaultPanelName", "net");
        profile.setPreference("extensions.firebug.net.enableSites", true);

        // Set default NetExport preferences
        profile.setPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);
        // Export to Server.
        String url = cerberusUrl + "/SaveStatistic?logId=" + executionUUID;
        profile.setPreference("extensions.firebug.netexport.autoExportToServer", true);
        profile.setPreference("extensions.firebug.netexport.beaconServerURL", url);
        MyLogger.log(SeleniumService.class.getName(), Level.DEBUG,
                "Selenium netexport.beaconServerURL : " + url);
        // Export to File. This only works on the selenium server side so should not be used as we don't know where to put the file and neither if Linux or Windows based.
        //            String cerberusHarPath = "logHar" + myFile.separator;
        //            String cerberusHarPath = "logHar" ;
        //            File dir = new File(cerberusHarPath + runId);
        //            dir.mkdirs();
        //            profile.setPreference("extensions.firebug.netexport.autoExportToFile", true);
        //            profile.setPreference("extensions.firebug.netexport.defaultLogDir", cerberusHarPath );
        //            MyLogger.log(SeleniumService.class.getName(), Level.DEBUG, "Selenium netexport.defaultLogDir : " + cerberusHarPath);
        profile.setPreference("extensions.firebug.netexport.sendToConfirmation", false);
        profile.setPreference("extensions.firebug.netexport.showPreview", false);

    }

    DesiredCapabilities dc = DesiredCapabilities.firefox();
    dc.setCapability(FirefoxDriver.PROFILE, profile);

    return dc;
}