List of usage examples for org.openqa.selenium.firefox FirefoxProfile FirefoxProfile
public FirefoxProfile()
From source file:org.apache.nutch.protocol.webdriver.HttpWebClient.java
License:Apache License
public static String getHtmlPage(String url, Configuration conf) { WebDriver driver = null;//from www . j av a 2 s. c o m try { FirefoxProfile profile = new FirefoxProfile(); String proxyHost = conf.get("http.proxy.host"); int proxyPort = conf.getInt("http.proxy.port", 8080); if (proxyHost != null && proxyHost.length() > 0) { profile.setPreference("network.proxy.type", 1); profile.setPreference("network.proxy.http", proxyHost); profile.setPreference("network.proxy.http_port", proxyPort); } DesiredCapabilities capabilities = DesiredCapabilities.firefox(); capabilities.setCapability("marionette", true); capabilities.setCapability("firefox_profile", profile); int driverServicePort = conf.getInt("webdriver.service.port", 4444); DriverService ds = NutchDriverService.createDriverService(driverServicePort); driver = new NutchFirefoxDriver(ds, capabilities); driver.get(url); // Wait for the page to load, timeout after 3 seconds new WebDriverWait(driver, 3); // Extract body String innerHtml = driver.findElement(By.tagName("body")).getAttribute("innerHTML"); return innerHtml; // I'm sure this catch statement is a code smell ; borrowing it from // lib-htmlunit } catch (Exception e) { throw new RuntimeException(e); } finally { if (driver != null) try { driver.quit(); } catch (Exception e) { throw new RuntimeException(e); } } }
From source file:org.apache.openmeetings.test.selenium.AbstractTestDefaults.java
License:Apache License
@Before public void setUp() throws Exception { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("intl.accept_languages", getLocale()); driver = new FirefoxDriver(profile); }
From source file:org.apache.roller.selenium.InitialLoginTestIT.java
License:Apache License
@Before public void setUp() throws Exception { FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("intl.accept_languages", "en_US"); driver = new FirefoxDriver(profile); baseUrl = "http://localhost:8080/roller/"; driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); }
From source file:org.apache.zeppelin.WebDriverManager.java
License:Apache License
public static WebDriver getWebDriver() { WebDriver driver = null;//from w w w. j ava 2 s . c o m if (driver == null) { try { FirefoxBinary ffox = new FirefoxBinary(); if ("true".equals(System.getenv("TRAVIS"))) { ffox.setEnvironmentProperty("DISPLAY", ":99"); // xvfb is supposed to // run with DISPLAY 99 } int firefoxVersion = WebDriverManager.getFirefoxVersion(); LOG.info("Firefox version " + firefoxVersion + " detected"); downLoadsDir = FileUtils.getTempDirectory().toString(); String tempPath = downLoadsDir + "/firefox/"; downloadGeekoDriver(firefoxVersion, tempPath); FirefoxProfile profile = new FirefoxProfile(); profile.setPreference("browser.download.folderList", 2); profile.setPreference("browser.download.dir", downLoadsDir); profile.setPreference("browser.helperApps.alwaysAsk.force", false); profile.setPreference("browser.download.manager.showWhenStarting", false); profile.setPreference("browser.download.manager.showAlertOnComplete", false); profile.setPreference("browser.download.manager.closeWhenDone", true); profile.setPreference("app.update.auto", false); profile.setPreference("app.update.enabled", false); profile.setPreference("dom.max_script_run_time", 0); profile.setPreference("dom.max_chrome_script_run_time", 0); profile.setPreference("browser.helperApps.neverAsk.saveToDisk", "application/x-ustar,application/octet-stream,application/zip,text/csv,text/plain"); profile.setPreference("network.proxy.type", 0); System.setProperty(GeckoDriverService.GECKO_DRIVER_EXE_PROPERTY, tempPath + "geckodriver"); System.setProperty(SystemProperty.DRIVER_USE_MARIONETTE, "false"); FirefoxOptions firefoxOptions = new FirefoxOptions(); firefoxOptions.setBinary(ffox); firefoxOptions.setProfile(profile); driver = new FirefoxDriver(firefoxOptions); } catch (Exception e) { LOG.error("Exception in WebDriverManager while FireFox Driver ", e); } } if (driver == null) { try { driver = new ChromeDriver(); } catch (Exception e) { LOG.error("Exception in WebDriverManager while ChromeDriver ", e); } } if (driver == null) { try { driver = new SafariDriver(); } catch (Exception e) { LOG.error("Exception in WebDriverManager while SafariDriver ", e); } } String url; if (System.getenv("url") != null) { url = System.getenv("url"); } else { url = "http://localhost:8080"; } long start = System.currentTimeMillis(); boolean loaded = false; driver.manage().timeouts().implicitlyWait(AbstractZeppelinIT.MAX_IMPLICIT_WAIT, TimeUnit.SECONDS); driver.get(url); while (System.currentTimeMillis() - start < 60 * 1000) { // wait for page load try { (new WebDriverWait(driver, 30)).until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver d) { return d.findElement(By.xpath("//i[@uib-tooltip='WebSocket Connected']")).isDisplayed(); } }); loaded = true; break; } catch (TimeoutException e) { LOG.info("Exception in WebDriverManager while WebDriverWait ", e); driver.navigate().to(url); } } if (loaded == false) { fail(); } driver.manage().window().maximize(); return driver; }
From source file:org.apache.zeppelin.ZeppelinIT.java
License:Apache License
private WebDriver getWebDriver() { WebDriver driver = null;/*from w ww .ja v a2 s. c om*/ if (driver == null) { try { FirefoxBinary ffox = new FirefoxBinary(); if ("true".equals(System.getenv("TRAVIS"))) { ffox.setEnvironmentProperty("DISPLAY", ":99"); // xvfb is supposed to // run with DISPLAY 99 } FirefoxProfile profile = new FirefoxProfile(); driver = new FirefoxDriver(ffox, profile); } catch (Exception e) { } } if (driver == null) { try { driver = new ChromeDriver(); } catch (Exception e) { } } if (driver == null) { try { driver = new SafariDriver(); } catch (Exception e) { } } String url; if (System.getProperty("url") != null) { url = System.getProperty("url"); } else { url = "http://localhost:8080"; } long start = System.currentTimeMillis(); boolean loaded = false; driver.get(url); while (System.currentTimeMillis() - start < 60 * 1000) { // wait for page load try { (new WebDriverWait(driver, 5)).until(new ExpectedCondition<Boolean>() { @Override public Boolean apply(WebDriver d) { return d.findElement(By.partialLinkText("Create new note")).isDisplayed(); } }); loaded = true; break; } catch (TimeoutException e) { driver.navigate().to(url); } } if (loaded == false) { fail(); } return driver; }
From source file:org.asqatasun.tgol.test.scenario.AbstractWebDriverTestClass.java
License:Open Source License
/** * *//*w ww. j a va 2 s .c o m*/ private void initialize() { // Mysql access parameters are passed as JVM argument // dbUrl = System.getProperty(DB_URL_KEY); // dbName = System.getProperty(DB_NAME_KEY); // dbUser = System.getProperty(DB_USER_KEY); // dbPassword = System.getProperty(DB_PASSWORD_KEY); // initDb(); // These parameters has to passed as JVM argument user = System.getProperty(USER_KEY); password = System.getProperty(PASSWORD_KEY); hostLocation = System.getProperty(HOST_LOCATION_KEY); xvfbDisplay = System.getProperty(XVFB_DISPLAY_KEY); // createRootUserInDb(); ResourceBundle parametersBundle = ResourceBundle.getBundle(BUNDLE_NAME); userFieldName = parametersBundle.getString(USER_FIELD_NAME_KEY); passwordFieldName = parametersBundle.getString(PASSWORD_FIELD_NAME_KEY); loginUrl = hostLocation + parametersBundle.getString(LOGIN_URL_KEY); logoutUrl = hostLocation + parametersBundle.getString(LOGOUT_URL_KEY); adminUrl = hostLocation + parametersBundle.getString(ADMIN_URL_KEY); addUserUrl = hostLocation + parametersBundle.getString(ADD_USER_URL_KEY); editUserUrl = hostLocation + parametersBundle.getString(EDIT_USER_URL_KEY); deleteUserUrl = hostLocation + parametersBundle.getString(DELETE_USER_URL_KEY); addContractUrl = hostLocation + parametersBundle.getString(ADD_CONTRACT_URL_KEY); contractUrl = hostLocation + parametersBundle.getString(CONTRACT_URL_KEY); auditPagesSetupUrl = hostLocation + parametersBundle.getString(AUDIT_PAGES_URL_KEY); auditSiteSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SITE_URL_KEY); auditUploadSetupUrl = hostLocation + parametersBundle.getString(AUDIT_UPLOAD_URL_KEY); auditScenarioSetupUrl = hostLocation + parametersBundle.getString(AUDIT_SCENARIO_URL_KEY); addUserContractUrl = hostLocation + parametersBundle.getString(ADD_USER_CONTRACT_URL_KEY); editUserContractUrl = hostLocation + parametersBundle.getString(EDIT_USER_CONTRACT_URL_KEY); if (driver == null) { FirefoxBinary ffBinary = new FirefoxBinary(); if (xvfbDisplay != null) { Logger.getLogger(this.getClass()).info("Setting Xvfb display with value " + xvfbDisplay); ffBinary.setEnvironmentProperty("DISPLAY", xvfbDisplay); } driver = new FirefoxDriver(ffBinary, new FirefoxProfile()); } }
From source file:org.asqatasun.websnapshot.service.SnapshotCreatorImpl.java
License:Open Source License
/** * * @return/*from www .ja v a 2s . co m*/ */ private RemoteWebDriver getWebDriver(int windowWidth, int windowHeight, String webDriver) { RemoteWebDriver driver; if (webDriver.equals(FIREFOX_BROWSER_NAME)) { driver = new FirefoxDriver(new FirefoxBinary(new File(firefoxBinaryPath)), new FirefoxProfile()); } else { DesiredCapabilities caps = DesiredCapabilities.phantomjs(); caps.setCapability(PhantomJSDriverService.PHANTOMJS_EXECUTABLE_PATH_PROPERTY, phantomJsBinaryPath); driver = new PhantomJSDriver(caps); } driver.manage().window().setSize(new Dimension(windowWidth, windowHeight)); return driver; }
From source file:org.cerberus.engine.execution.impl.SeleniumServerService.java
License:Open Source License
/** * Instanciate DesiredCapabilities regarding the browser * @param capabilities/*from w w w. j a v a2 s . c o m*/ * @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 {// w w w . j a v a 2 s. com 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 {/* w w w . j a va 2 s .c om*/ 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; }