Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,4 @@ private static Func<IWebDriver, bool> 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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading