From bc0ed99129fb20b2f12da93fb10d60c1812a6101 Mon Sep 17 00:00:00 2001 From: Mackinnon Buck Date: Fri, 16 Aug 2024 09:00:33 -0700 Subject: [PATCH] Fix CanBindToFormWithFiles (#57355) --- .../FormWithParentBindingContextTest.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs b/src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs index 4b35b0c5eed0..06d57a454b7f 100644 --- a/src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs +++ b/src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs @@ -1596,7 +1596,7 @@ private void DispatchToFormCore(DispatchToForm dispatch) if (!dispatch.FormIsEnhanced) { // Verify the same form element is *not* still in the page - Assert.Throws(() => form.GetAttribute("method")); + Browser.True(() => IsElementStale(form)); } else if (!dispatch.SuppressEnhancedNavigation) { @@ -1648,6 +1648,19 @@ private void GoTo(string relativePath) Navigate($"{ServerPathBase}/{relativePath}"); } + private static bool IsElementStale(IWebElement element) + { + try + { + _ = element.Enabled; + return false; + } + catch (StaleElementReferenceException) + { + return true; + } + } + private struct TempFile { public string Name { get; }