Skip to content

Instantly share code, notes, and snippets.

@freynaud
Created May 25, 2011 15:36
Show Gist options
  • Save freynaud/991189 to your computer and use it in GitHub Desktop.
Save freynaud/991189 to your computer and use it in GitHub Desktop.
tom
File tempDir = TemporaryFilesystem.getDefaultTmpFS().createTempDir("userprofile", "copy");
try {
File certdb = new File(tempDir, "cert8.db");
writeResourceToFile(certdb, "cert8.db", Demo.class);
// Delete the old compreg.dat file so that our new extension is
// registered
File compreg = new File(tempDir, "compreg.dat");
if (compreg.exists()) {
if (!compreg.delete()) {
throw new WebDriverException("Cannot delete file from copy of profile ");
}
}
} catch (IOException e) {
throw new WebDriverException(e);
}
FirefoxProfile profile = new ProfileFromDirectory(tempDir);
DesiredCapabilities cap = DesiredCapabilities.firefox();
cap.setCapability(FirefoxDriver.PROFILE, profile);
cap.setVersion("4.0");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment