diff --git a/src/org/labkey/test/components/ui/grids/QueryGrid.java b/src/org/labkey/test/components/ui/grids/QueryGrid.java index 2f13d8ddda..81f4d5438e 100644 --- a/src/org/labkey/test/components/ui/grids/QueryGrid.java +++ b/src/org/labkey/test/components/ui/grids/QueryGrid.java @@ -28,6 +28,7 @@ import org.labkey.test.util.selenium.WebElementUtils; import org.openqa.selenium.Keys; import org.openqa.selenium.NoSuchElementException; +import org.openqa.selenium.StaleElementReferenceException; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.interactions.Actions; @@ -642,6 +643,12 @@ public String getEditAlertText() * @return The name of the grid view from the header. Empty string if no header (default view). */ public String getViewName() + { + // The header re-renders while the grid reloads, so find it again if it goes stale + return getWrapper().shortWait().ignoring(StaleElementReferenceException.class).until(_ -> readViewName()); + } + + private String readViewName() { String viewName;