From 8ea5c71f50ca5c7d1bbc8e5f8f9afaa9f1083f4b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:00:01 +0000 Subject: [PATCH 1/2] Initial plan From 16a23b3050e72ec8782749ab473cfc1542ffc3e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 27 Nov 2025 13:08:45 +0000 Subject: [PATCH 2/2] Remove redundant IsElementStale method and use WebDriverExtensions.IsStale Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com> --- .../ServerRenderingTests/EnhancedNavigationTest.cs | 3 --- .../EnhancedNavigationTestUtil.cs | 13 ------------- .../ServerRenderingTests/InteractivityTest.cs | 2 +- 3 files changed, 1 insertion(+), 17 deletions(-) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs index c7f52c3c155e..5b28c9d299ac 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs @@ -989,7 +989,4 @@ private static Func ElementWithTextAppears(By selector, string // Ensure we actually observed the new content, not just the presence of the element. return string.Equals(elements[0].Text, expectedText, StringComparison.Ordinal); }; - - private static bool IsElementStale(IWebElement element) - => EnhancedNavigationTestUtil.IsElementStale(element); } diff --git a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs index 12fac8e74548..1fa7b8fce9e3 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs @@ -97,17 +97,4 @@ public static long GetScrollY(this IWebDriver browser) public static long SetScrollY(this IWebDriver browser, long value) => Convert.ToInt64(((IJavaScriptExecutor)browser).ExecuteScript($"window.scrollTo(0, {value})"), CultureInfo.CurrentCulture); - - public static bool IsElementStale(IWebElement element) - { - try - { - _ = element.Enabled; - return false; - } - catch (StaleElementReferenceException) - { - return true; - } - } } diff --git a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs index 4ea368a72437..4fe0a5d42647 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs @@ -1308,7 +1308,7 @@ public void CanPerformNavigateToFromInteractiveEventHandler(bool suppressEnhance // Verify the elements were preserved if and only if they should be var shouldPreserveElements = !suppressEnhancedNavigation && !forceLoad; - Assert.Equal(shouldPreserveElements, !EnhancedNavigationTestUtil.IsElementStale(originalNavElem)); + Assert.Equal(shouldPreserveElements, !originalNavElem.IsStale()); } private void BlockWebAssemblyResourceLoad()