Esempio n. 1
0
  protected File getUniqueProfileDir() {
    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
    if (!tmpDir.exists())
      throw new RuntimeException("Unable to find default temp directory: " + tmpDir);

    String probablyUniqueName =
        "webdriver-custom-" + System.currentTimeMillis() + nextId.getAndIncrement();

    File profileDir = new File(tmpDir, probablyUniqueName);

    rememberToClean(profileDir);

    return profileDir;
  }
Esempio n. 2
0
  public FirefoxProfile createCopy(int port) {
    File tmpDir = new File(System.getProperty("java.io.tmpdir"));
    File to = new File(tmpDir, "webdriver-" + System.currentTimeMillis());
    to.mkdirs();

    FileHandler.copyDir(profileDir, to);
    FirefoxProfile profile = new FirefoxProfile(to);
    additionalPrefs.addTo(profile);
    profile.setPort(port);
    profile.updateUserPrefs();

    rememberToClean(to);

    return profile;
  }