Skip to content

Commit 485495f

Browse files
Copilotjaviercn
andauthored
Remove redundant IsElementStale method and use WebDriverExtensions.IsStale (#64549)
* Initial plan * Remove redundant IsElementStale method and use WebDriverExtensions.IsStale Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: javiercn <6995051+javiercn@users.noreply.github.com>
1 parent 14d37af commit 485495f

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTest.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,4 @@ private static Func<IWebDriver, bool> ElementWithTextAppears(By selector, string
989989
// Ensure we actually observed the new content, not just the presence of the element.
990990
return string.Equals(elements[0].Text, expectedText, StringComparison.Ordinal);
991991
};
992-
993-
private static bool IsElementStale(IWebElement element)
994-
=> EnhancedNavigationTestUtil.IsElementStale(element);
995992
}

src/Components/test/E2ETest/ServerRenderingTests/EnhancedNavigationTestUtil.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,4 @@ public static long GetScrollY(this IWebDriver browser)
9797

9898
public static long SetScrollY(this IWebDriver browser, long value)
9999
=> Convert.ToInt64(((IJavaScriptExecutor)browser).ExecuteScript($"window.scrollTo(0, {value})"), CultureInfo.CurrentCulture);
100-
101-
public static bool IsElementStale(IWebElement element)
102-
{
103-
try
104-
{
105-
_ = element.Enabled;
106-
return false;
107-
}
108-
catch (StaleElementReferenceException)
109-
{
110-
return true;
111-
}
112-
}
113100
}

src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ public void CanPerformNavigateToFromInteractiveEventHandler(bool suppressEnhance
13081308

13091309
// Verify the elements were preserved if and only if they should be
13101310
var shouldPreserveElements = !suppressEnhancedNavigation && !forceLoad;
1311-
Assert.Equal(shouldPreserveElements, !EnhancedNavigationTestUtil.IsElementStale(originalNavElem));
1311+
Assert.Equal(shouldPreserveElements, !originalNavElem.IsStale());
13121312
}
13131313

13141314
private void BlockWebAssemblyResourceLoad()

0 commit comments

Comments
 (0)