Fixing legacy firefox driver initialization with no profile specified in options
import org.openqa.selenium.remote.service.DriverService;
import java.util.Objects;
+import java.util.Optional;
import java.util.Set;
import java.util.logging.Logger;
@@ -133,7 +134,7 @@ private static CommandExecutor toExecutor(FirefoxOptions options) {
if (options.isLegacy()) {
builder = XpiDriverService.builder()
.withBinary(options.getBinary())
- .withProfile(options.getProfile());
+ .withProfile(Optional.ofNullable(options.getProfile()).orElse(new FirefoxProfile()));
} else {
builder = new GeckoDriverService.Builder()
.usingFirefoxBinary(options.getBinary());
