Example usage for org.openqa.selenium.firefox FirefoxProfile addExtension

List of usage examples for org.openqa.selenium.firefox FirefoxProfile addExtension

Introduction

In this page you can find the example usage for org.openqa.selenium.firefox FirefoxProfile addExtension.

Prototype

public void addExtension(File extensionToInstall) 

Source Link

Document

Attempt to add an extension to install into this instance.

Usage

From source file:FirefoxConsoleExport.java

License:Open Source License

public FirefoxConsoleExport(int port) throws IOException {
    super(port);//from ww w .  j  ava  2  s  .com
    start(NanoHTTPD.SOCKET_READ_TIMEOUT, false);
    ClassLoader classLoader = FirefoxConsoleExport.class.getClassLoader();
    DesiredCapabilities cap = new DesiredCapabilities();
    cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
    FirefoxProfile fp = new FirefoxProfile();
    File extensionToInstall = new File(classLoader.getResource("firebug-2.0.16-fx.xpi").getFile());
    File extension2 = new File(classLoader.getResource("consoleExport-0.5b5.xpi").getFile());

    fp.addExtension(extensionToInstall);
    fp.addExtension(extension2);

    fp.setPreference("extensions.firebug.currentVersion", "2.0");
    fp.setPreference("extensions.firebug.console.enableSites", "true");
    fp.setPreference("extensions.firebug.net.enableSites", "true");
    fp.setPreference("extensions.firebug.script.enableSites", "true");
    fp.setPreference("extensions.firebug.allPagesActivation", "on");
    fp.setPreference("extensions.firebug.consoleexport.active", "true");
    fp.setPreference("extensions.firebug.consoleexport.serverURL", "http://127.0.0.1:9999");

    cap.setCapability(FirefoxDriver.PROFILE, fp);
    driver = new FirefoxDriver(cap);

}

From source file:com.cisco.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Opens the Firefox instance for Selenium.
 *//*ww w  .ja  v  a2s . c  o m*/
public static void openBrowser() {
    try {
        String browser = Validate.readsystemvariable("browser");
        LogHandler.info("Browser:" + browser);

        String digest = Validate.readsystemvariable("browser.digest");
        LogHandler.info("Digest Auth:" + digest);

        if (browser.equals("firefox") && digest.toUpperCase().equals("YES")) {
            LogHandler.info("Fire Fox Driver with addon configuration");
            FirefoxProfile profile = new FirefoxProfile();
            profile.setPreference("browser.link.open_newwindow", 2);
            File extentions = new File(
                    System.getProperty("user.dir") + Validate.readsystemvariable("firefox.addons.path"));
            if (extentions.exists()) {
                for (File extention : extentions.listFiles()) {
                    if (extention.getName().endsWith(".xpi")) {
                        try {
                            profile.addExtension(new File(extention.getAbsolutePath()));
                        } catch (IOException e) {
                            Assert.assertTrue("Exception occured while adding the extension to the profile..",
                                    false);
                        }
                        LogHandler.info("Added extention: " + extention.getName());
                    }
                }
            }
            driver = new FirefoxDriver(profile);
        } else if (browser.equals("firefox") && digest.toUpperCase().equals("NO")) {
            LogHandler.info("Fire Fox Driver without addon configuration");
            driver = new FirefoxDriver();
        } else if (browser.equals("chrome"))

        {
            LogHandler.info("Chrome Driver configuration");
            JarFile jarFile = jarfilehandler.jarForClass(SeleniumUtilities.class);
            jarfilehandler.copyResourcesToDirectory(jarFile, "chrome", "src/it/resources/chrome");
            System.setProperty("webdriver.chrome.driver", "src/it/resources/chrome/chromedriver.exe");
            driver = new ChromeDriver();

        } else if (browser.equals("IE")) {

            LogHandler.info("IE Driver configuration");
            DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
            String IEpath = (SeleniumUtilities.class).getResource("").getPath();
            System.out.println(IEpath.substring(0, IEpath.length() - 31));

            capabilities.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
                    true);
            capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

            JarFile jarFile = jarfilehandler.jarForClass(SeleniumUtilities.class);
            // JarFile jarFile = new
            // JarFile("C:\\Users\\amsathishkumar\\.m2\\repository\\com\\cisco\\dbds\\Utils\\0.0.1-Release\\Utils-0.0.1-Release.jar");
            jarfilehandler.copyResourcesToDirectory(jarFile, "internetexplorer",
                    "src/it/resources/InternetExplorer");

            System.setProperty("webdriver.ie.driver", "src/it/resources/internetexplorer/IEDriverServer.exe");
            driver = new InternetExplorerDriver(capabilities);

            // driver = new InternetExplorerDriver();
        } else {
            Assert.assertTrue("include the browswer variable...", false);
        }
    } catch (Exception e) {
        LogHandler.info("Check the varaiables: browser,firefox.addons.path,user.dir");

    }
    //   driver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);
    //   driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
    driver.manage().window().maximize();
    driver.manage().timeouts().implicitlyWait(Integer.parseInt(System.getProperty("implicit.wait")),
            TimeUnit.SECONDS);
    driver.manage().timeouts().pageLoadTimeout(Integer.parseInt(System.getProperty("explicit.wait")),
            TimeUnit.SECONDS);
}

From source file:com.sat.dbds.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Opens the Firefox instance for Selenium.
 */// w ww.j a  v  a  2s  .  c o m
public static void openBrowser() {
    if (System.getProperty("run.type") == null || System.getProperty("run.type").equalsIgnoreCase("WUI")) {
        if (getDriver() != null)
            System.out.println(getDriver().toString() + "hi");
        if (getDriver() == null || (!getDriver().toString().contains("-"))) {
            try {

                String browser = Validate.readsystemvariable("browser");
                LogHandler.info("Browser:" + browser);

                String digest = Validate.readsystemvariable("browser.digest");
                LogHandler.info("Digest Auth:" + digest);

                if (browser.equals("firefox") && digest.toUpperCase().equals("YES")) {
                    LogHandler.info("Fire Fox Driver with addon configuration");
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.setPreference("browser.link.open_newwindow", 2);
                    File extentions = new File(System.getProperty("user.dir")
                            + Validate.readsystemvariable("firefox.addons.path"));
                    if (extentions.exists()) {
                        for (File extention : extentions.listFiles()) {
                            if (extention.getName().endsWith(".xpi")) {
                                try {
                                    profile.addExtension(new File(extention.getAbsolutePath()));
                                } catch (IOException e) {
                                    Assert.assertTrue(
                                            "Exception occured while adding the extension to the profile..",
                                            false);
                                }
                                LogHandler.info("Added extention: " + extention.getName());
                            }
                        }
                    }
                    driver = new FirefoxDriver(profile);
                } else if (browser.equals("firefox") && digest.toUpperCase().equals("NO")) {
                    LogHandler.info("Fire Fox Driver without addon configuration");
                    driver = new FirefoxDriver();
                } else if (browser.equals("chrome"))

                {
                    LogHandler.info("Chrome Driver configuration");
                    JarFile jarFile = jarfilehandler.jarForClass(SeleniumUtilities.class);
                    jarfilehandler.copyResourcesToDirectory(jarFile, "chrome", "src/it/resources/chrome");
                    System.setProperty("webdriver.chrome.driver", "src/it/resources/chrome/chromedriver.exe");
                    driver = new ChromeDriver();

                } else if (browser.equals("IE")) {

                    LogHandler.info("IE Driver configuration");
                    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
                    String IEpath = (SeleniumUtilities.class).getResource("").getPath();
                    System.out.println(IEpath.substring(0, IEpath.length() - 31));

                    capabilities.setCapability(
                            InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
                    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

                    JarFile jarFile = jarfilehandler.jarForClass(SeleniumUtilities.class);
                    // JarFile jarFile = new
                    // JarFile("C:\\Users\\amsathishkumar\\.m2\\repository\\com\\cisco\\dbds\\Utils\\0.0.1-Release\\Utils-0.0.1-Release.jar");
                    jarfilehandler.copyResourcesToDirectory(jarFile, "internetexplorer",
                            "src/it/resources/InternetExplorer");

                    System.setProperty("webdriver.ie.driver",
                            "src/it/resources/internetexplorer/IEDriverServer.exe");
                    driver = new InternetExplorerDriver(capabilities);

                    // driver = new InternetExplorerDriver();
                } else {
                    Assert.assertTrue("include the browswer variable...", false);
                }
            } catch (Exception e) {
                LogHandler.info("Check the varaiables: browser,firefox.addons.path,user.dir");

            }
            //   driver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);
            //   driver.manage().timeouts().setScriptTimeout(10, TimeUnit.SECONDS);
            driver.manage().window().maximize();
            driver.manage().timeouts().implicitlyWait(Integer.parseInt(System.getProperty("implicit.wait")),
                    TimeUnit.SECONDS);
            driver.manage().timeouts().pageLoadTimeout(Integer.parseInt(System.getProperty("explicit.wait")),
                    TimeUnit.SECONDS);
            System.out.println(getDriver().toString() + "hi");
        }
    }
}

From source file:com.sat.spvgt.utils.selenium.SeleniumUtilities.java

License:Open Source License

/**
 * Opens the Firefox instance for Selenium.
 *//*from w  ww.  ja v a 2s .  com*/
public static void openBrowser() {
    if (System.getProperty("run.type") == null) {
        try {
            if (getDriver() == null || (!getDriver().toString().contains("-"))) {
                String browser = miscValidate.readsystemvariable("browser");
                LogHandler.info("Browser:" + browser);

                String digest = miscValidate.readsystemvariable("browser.digest");
                LogHandler.info("Digest Auth:" + digest);

                if (browser.equals("firefox") && digest.toUpperCase().equals("YES")) {
                    LogHandler.info("Fire Fox Driver with addon configuration");
                    FirefoxProfile profile = new FirefoxProfile();
                    profile.setPreference("browser.link.open_newwindow", 2);
                    File extentions = new File(System.getProperty("user.dir")
                            + miscValidate.readsystemvariable("firefox.addons.path"));
                    if (extentions.exists()) {
                        for (File extention : extentions.listFiles()) {
                            if (extention.getName().endsWith(".xpi")) {
                                try {
                                    profile.addExtension(new File(extention.getAbsolutePath()));
                                } catch (IOException e) {
                                    Assert.assertTrue(
                                            "Exception occured while adding the extension to the profile..",
                                            false);
                                }
                                LogHandler.info("Added extention: " + extention.getName());
                            }
                        }
                    }
                    driver = new FirefoxDriver(profile);
                } else if (browser.equals("firefox") && digest.toUpperCase().equals("NO")) {
                    LogHandler.info("Fire Fox Driver without addon configuration");
                    driver = new FirefoxDriver();
                } else if (browser.equals("chrome"))

                {
                    LogHandler.info("Chrome Driver configuration");
                    JarFile jarFile = miscJarfileHandler.jarForClass(SeleniumUtilities.class);
                    miscJarfileHandler.copyResourcesToDirectory(jarFile, "chrome", "src/it/resources/chrome");
                    System.setProperty("webdriver.chrome.driver", "src/it/resources/chrome/chromedriver.exe");
                    driver = new ChromeDriver();

                } else if (browser.equals("IE")) {

                    LogHandler.info("IE Driver configuration");
                    DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
                    String IEpath = (SeleniumUtilities.class).getResource("").getPath();
                    System.out.println(IEpath.substring(0, IEpath.length() - 31));

                    capabilities.setCapability(
                            InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
                    capabilities.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);

                    JarFile jarFile = miscJarfileHandler.jarForClass(SeleniumUtilities.class);
                    // JarFile jarFile = new
                    // JarFile("C:\\Users\\amsathishkumar\\.m2\\repository\\com\\cisco\\dbds\\Utils\\0.0.1-Release\\Utils-0.0.1-Release.jar");
                    miscJarfileHandler.copyResourcesToDirectory(jarFile, "internetexplorer",
                            "src/it/resources/InternetExplorer");

                    System.setProperty("webdriver.ie.driver",
                            "src/it/resources/internetexplorer/IEDriverServer.exe");
                    driver = new InternetExplorerDriver(capabilities);

                    // driver = new InternetExplorerDriver();
                } else {
                    Assert.assertTrue("include the browswer variable...", false);
                }
            }
        } catch (Exception e) {
            LogHandler.info("Check the varaiables: browser,firefox.addons.path,user.dir");

        }
        // driver.manage().timeouts().pageLoadTimeout(3, TimeUnit.SECONDS);
        // driver.manage().timeouts().setScriptTimeout(10,
        // TimeUnit.SECONDS);
        driver.manage().window().maximize();
        driver.manage().timeouts().implicitlyWait(Integer.parseInt(System.getProperty("implicit.wait")),
                TimeUnit.SECONDS);
        driver.manage().timeouts().pageLoadTimeout(Integer.parseInt(System.getProperty("explicit.wait")),
                TimeUnit.SECONDS);
    }
}

From source file:de.ppi.selenium.browser.DefaultWebDriverFactory.java

License:Apache License

/**
 *
 * @param ffp the firefox profile specified
 * @param extensions extensions desired to be added
 * @throws IOException/*from w  w w .  j a va2 s  .com*/
 */
private static void addExtensionsToFirefoxProfile(FirefoxProfile ffp, List<String> extensions)
        throws IOException {
    for (String s : extensions) {
        ffp.addExtension(new File(s));
    }
}

From source file:evaluation.ExperimentRunner.java

License:Apache License

private void setup() throws Exception {
    System.out.println("xxx1");
    DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
    LoggingPreferences loggingPreferences = new LoggingPreferences();
    System.out.println("xxx2");
    loggingPreferences.enable(LogType.BROWSER, Level.ALL);
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences);
    FirefoxBinary binary = new FirefoxBinary(new File(firefoxBinary));
    FirefoxProfile profile = new FirefoxProfile();
    System.out.println("xxx3");
    System.setProperty("webdriver.firefox.logfile", firefoxLogFile);
    profile.setPreference("webdriver.log.file", javascriptLogFile);
    profile.setPreference("dom.max_script_run_time", maxWaitTime);
    // Do not divert any links (browser.link.open_newwindow will have no
    // effect)./*from   ww  w  .j  a  v  a2 s.  c o m*/
    // http://kb.mozillazine.org/Browser.link.open_newwindow.restriction
    profile.setPreference("dom.popup_allowed_events", "");
    profile.setPreference("dom.popup_maximum", 0);
    profile.addExtension(new File(jalangiFFxpi));
    System.out.println("xxx4");
    driver = new FirefoxDriver(binary, profile, desiredCapabilities);
    System.out.println("xxx5");
    driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);
    System.out.println("xxx6");
}

From source file:evaluation.OctaneExperimentRunner.java

License:Apache License

private void run(String benchmark) throws Exception {
    DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox();
    LoggingPreferences loggingPreferences = new LoggingPreferences();
    loggingPreferences.enable(LogType.BROWSER, Level.ALL);
    desiredCapabilities.setCapability(CapabilityType.LOGGING_PREFS, loggingPreferences);
    FirefoxBinary binary = new FirefoxBinary(new File(firefoxBinary));
    FirefoxProfile profile = new FirefoxProfile();
    System.setProperty("webdriver.firefox.logfile", firefoxLogFile);
    profile.setPreference("webdriver.log.file", javascriptLogFile);
    profile.setPreference("dom.max_script_run_time", maxWaitTime);
    profile.setPreference("extensions.sdk.console.logLevel", "info");
    profile.addExtension(new File(jalangiFFxpi));
    driver = new FirefoxDriver(binary, profile, desiredCapabilities);
    driver.manage().timeouts().implicitlyWait(120, TimeUnit.SECONDS);

    testBenchmark(benchmark);//from  w w  w  .  ja v a2  s.  c o m

    driver.quit();
    System.out.println("Done :-)");
}

From source file:jp.co.nssol.h5.test.selenium.base.DriverFactory.java

License:Apache License

/**
 * FireFox????//  w  w  w.  j  a va2  s.  c o  m
 *
 * @return
 */
private static WebDriver setupFireFoxDriver() {
    FirefoxProfile profile = null;

    try {
        File file = new File(SettingsReader.getProperty(PKEY_FIREBUG_PATH));
        profile = new FirefoxProfile();
        profile.addExtension(file);
        profile.setAcceptUntrustedCertificates(true);
        profile.setAssumeUntrustedCertificateIssuer(false);
        profile.setPreference("extensions.firebug.currentVersion", "1.9.1");
    } catch (IOException e) {
        e.printStackTrace();
    }

    return new FirefoxDriver(profile) {
        @Override
        public String toString() {
            return "FireFox";
        }
    };
}

From source file:org.asqatasun.sebuilder.tools.ProfileFactory.java

License:Open Source License

/**
 * Add entension /*from   ww  w  .  ja  v a  2  s  . c  o m*/
 * @param firefoxProfile 
 */
private void setUpExtensions(FirefoxProfile firefoxProfile) {
    for (String extensionPath : extensionPathList) {
        try {
            firefoxProfile.addExtension(new File(extensionPath));
        } catch (IOException ex) {
            Logger.getLogger(this.getClass()).error(ex);
        }
    }

    //----------------------------------------------------------------------
    // Firebug options
    //----------------------------------------------------------------------
    firefoxProfile.setPreference("extensions.firebug.allPagesActivation", "on");
    firefoxProfile.setPreference("extensions.firebug.defaultPanelName", "net");
    firefoxProfile.setPreference("extensions.firebug.net.enableSites", true);
    firefoxProfile.setPreference("extensions.firebug.script.enableSites", true);
    firefoxProfile.setPreference("extensions.firebug.onByDefault", true);
    firefoxProfile.setPreference("extensions.firebug.currentVersion", firebugVersion);
    //----------------------------------------------------------------------

    //----------------------------------------------------------------------
    // NetExport options
    //----------------------------------------------------------------------
    // Auto export feature is enabled by default.
    firefoxProfile.setPreference("extensions.firebug.netexport.alwaysEnableAutoExport", true);

    // Auto export feature stores results into a local file
    firefoxProfile.setPreference("extensions.firebug.netexport.autoExportToFile", true);

    // Auto export feature sends results to the server (default is false)
    firefoxProfile.setPreference("extensions.firebug.netexport.autoExportToServer", false);

    // Show preview of exported data by default.
    firefoxProfile.setPreference("extensions.firebug.netexport.showPreview", false);

    // Displaye confirmation before uploading collecetd data to the server yes/no.
    firefoxProfile.setPreference("extensions.firebug.netexport.sendToConfirmation", false);

    // Number of milliseconds to wait after the last page request to declare the page loaded.
    // We don't wast time
    //        firefoxProfile.setPreference("extensions.firebug.netexport.pageLoadedTimeout", pageLoadedTimeout);

    // Number of milliseconds to wait after the page is exported even if not loaded yet.
    // Set to zero to switch off this feature.
    //        firefoxProfile.setPreference("extensions.firebug.netexport.timeout", timeout);

    //
    firefoxProfile.setPreference("extensions.firebug.netexport.Automation", true);

    // Default log directory for auto-exported HAR files.
    firefoxProfile.setPreference("extensions.firebug.netexport.defaultLogDir",
            createRandomNetExportPath(firefoxProfile));
}

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   ww  w  .ja v a2s  . 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;
}