Skip to content

Commit

Permalink
Fix CanBindToFormWithFiles (dotnet#57355)
Browse files Browse the repository at this point in the history
  • Loading branch information
MackinnonBuck committed Aug 16, 2024
1 parent 3babc09 commit bc0ed99
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<StaleElementReferenceException>(() => form.GetAttribute("method"));
Browser.True(() => IsElementStale(form));
}
else if (!dispatch.SuppressEnhancedNavigation)
{
Expand Down Expand Up @@ -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; }
Expand Down

0 comments on commit bc0ed99

Please sign in to comment.