Created
May 25, 2011 15:36
-
-
Save freynaud/991189 to your computer and use it in GitHub Desktop.
tom
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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