From ca627449c1bf946adb6203ed8fa2985989ac40af Mon Sep 17 00:00:00 2001 From: Chandan sharma Date: Wed, 1 Apr 2026 16:51:38 +0300 Subject: [PATCH 1/2] [java] fix NoSuchElementException for custom By locators Modified ElementLocation to throw NoSuchElementException when a context-based finder returns null. Ensures symmetry with the remote finder and maintains backward compatibility for custom locators. render_diffs(file:///d:/projects/selenium/java/src/org/openqa/selenium/remote/ElementLocation.java) render_diffs(file:///d:/projects/selenium/rb/lib/selenium/webdriver/common/websocket_connection.rb) render_diffs(file:///d:/projects/selenium/rb/lib/selenium/webdriver/devtools/network_interceptor.rb) render_diffs(file:///d:/projects/selenium/rb/lib/selenium/webdriver/common/driver_extensions/has_network_interception.rb) --- java/src/org/openqa/selenium/remote/ElementLocation.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/java/src/org/openqa/selenium/remote/ElementLocation.java b/java/src/org/openqa/selenium/remote/ElementLocation.java index c44d10364bfbe..3d0db05bf55c6 100644 --- a/java/src/org/openqa/selenium/remote/ElementLocation.java +++ b/java/src/org/openqa/selenium/remote/ElementLocation.java @@ -138,6 +138,9 @@ WebElement findElement( BiFunction createPayload, By locator) { WebElement element = locator.findElement(context); + if (element == null) { + throw new NoSuchElementException("Unable to find element with locator " + locator); + } return massage(driver, context, element, locator); } @@ -148,6 +151,10 @@ List findElements( BiFunction createPayload, By locator) { List elements = locator.findElements(context); + if (elements == null) { + return Collections.emptyList(); + } + return elements.stream() .map(e -> massage(driver, context, e, locator)) .collect(Collectors.toList()); From 3651662f8c97c6d742c00f68ed876d193ca0ed66 Mon Sep 17 00:00:00 2001 From: Corey Goldberg <1113081+cgoldberg@users.noreply.github.com> Date: Thu, 2 Apr 2026 13:52:45 -0400 Subject: [PATCH 2/2] Retry CLA Assistant workflow