From cb18a1180be316717db298b85e3df1dfb68523c5 Mon Sep 17 00:00:00 2001 From: Trig <7973740+Trigtrig@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:58:55 +0100 Subject: [PATCH] Fixing NPE when "se:downloadsEnabled" not set Fixes the NPE described in https://github.com/SeleniumHQ/selenium/issues/13578 --- java/src/org/openqa/selenium/HasDownloads.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/src/org/openqa/selenium/HasDownloads.java b/java/src/org/openqa/selenium/HasDownloads.java index d759f279cc349..2d65a35f48b77 100644 --- a/java/src/org/openqa/selenium/HasDownloads.java +++ b/java/src/org/openqa/selenium/HasDownloads.java @@ -33,7 +33,7 @@ public interface HasDownloads { * @throws WebDriverException if capability to enable downloads is not set */ default void requireDownloadsEnabled(Capabilities capabilities) { - boolean downloadsEnabled = (boolean) capabilities.getCapability("se:downloadsEnabled"); + boolean downloadsEnabled = capabilities.is("se:downloadsEnabled"); if (!downloadsEnabled) { throw new WebDriverException( "You must enable downloads in order to work with downloadable files.");