Source:org.openqa.selenium.SessionNotCreatedException: Unable to find a matching set of capabilities while trying to launch Firefox with Selenium v3.8.1
ExecutorService es = Executors.newFixedThreadPool(4);
List<Runnable> tasks = getTasks();
CompletableFuture<?>[] futures = tasks.stream()
.map(task -> CompletableFuture.runAsync(task, es))
.toArray(CompletableFuture[]::new);
CompletableFuture.allOf(futures).join();
es.shutdown();