Skip to content

Commit bc0ed99

Browse files
Fix CanBindToFormWithFiles (#57355)
1 parent 3babc09 commit bc0ed99

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/Components/test/E2ETest/ServerRenderingTests/FormHandlingTests/FormWithParentBindingContextTest.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ private void DispatchToFormCore(DispatchToForm dispatch)
15961596
if (!dispatch.FormIsEnhanced)
15971597
{
15981598
// Verify the same form element is *not* still in the page
1599-
Assert.Throws<StaleElementReferenceException>(() => form.GetAttribute("method"));
1599+
Browser.True(() => IsElementStale(form));
16001600
}
16011601
else if (!dispatch.SuppressEnhancedNavigation)
16021602
{
@@ -1648,6 +1648,19 @@ private void GoTo(string relativePath)
16481648
Navigate($"{ServerPathBase}/{relativePath}");
16491649
}
16501650

1651+
private static bool IsElementStale(IWebElement element)
1652+
{
1653+
try
1654+
{
1655+
_ = element.Enabled;
1656+
return false;
1657+
}
1658+
catch (StaleElementReferenceException)
1659+
{
1660+
return true;
1661+
}
1662+
}
1663+
16511664
private struct TempFile
16521665
{
16531666
public string Name { get; }

0 commit comments

Comments
 (0)