code: public File createTempDir(String prefix, String suffix) {
      try {
        // Create a tempfile, and delete it.
        File file = File.createTempFile(prefix, suffix, baseDir);
        file.delete();
  
        // Create it as a directory.
        File dir = new File(file.getAbsolutePath());
        if (!dir.mkdirs()) {
          throw new WebDriverException("Cannot create profile directory at " + dir.getAbsolutePath());
        }
  
        // Create the directory and mark it writable.
        FileHandler.createDir(dir);
  
        temporaryFiles.add(dir);
        return dir;
      } catch (IOException e) {
        throw new WebDriverException(
            "Unable to create temporary file at " + baseDir.getAbsolutePath());
      }
    }
docs: Create a temporary directory, and track it for deletion.
  
  @param prefix the prefix to use when creating the temporary directory
  @param suffix the suffix to use when creating the temporary directory
  @return the temporary directory to create