diff --git a/java/src/org/openqa/selenium/remote/AbstractDriverOptions.java b/java/src/org/openqa/selenium/remote/AbstractDriverOptions.java index 9eb71c8ce2b8d..b0a5f6ba12a35 100644 --- a/java/src/org/openqa/selenium/remote/AbstractDriverOptions.java +++ b/java/src/org/openqa/selenium/remote/AbstractDriverOptions.java @@ -139,11 +139,13 @@ public Map asMap() { private Map getTimeouts() { Map newTimeouts = new HashMap<>(); Object raw = getCapability(TIMEOUTS); - ((Map) raw).forEach((key, value) -> { - if (key instanceof String && value instanceof Number) { - newTimeouts.put((String) key, (Number) value); - } - }); + if (raw != null) { + ((Map) raw).forEach((key, value) -> { + if (key instanceof String && value instanceof Number) { + newTimeouts.put((String) key, (Number) value); + } + }); + } return newTimeouts; } }