|
41 | 41 | import org.labkey.test.util.external.labModules.LabModuleHelper; |
42 | 42 | import org.openqa.selenium.By; |
43 | 43 | import org.openqa.selenium.Keys; |
| 44 | +import org.openqa.selenium.StaleElementReferenceException; |
44 | 45 | import org.openqa.selenium.WebElement; |
45 | 46 | import org.openqa.selenium.interactions.Actions; |
46 | 47 |
|
@@ -243,7 +244,18 @@ private void testFilterWidget() |
243 | 244 |
|
244 | 245 | private long getTotalVariantFeatures() |
245 | 246 | { |
246 | | - return Locator.findElements(getDriver(), Locator.tagWithClass("svg", "SvgFeatureRendering").append(Locator.tag("polygon"))).stream().filter(WebElement::isDisplayed).count(); |
| 247 | + Locator l = Locator.tagWithClass("svg", "SvgFeatureRendering").append(Locator.tag("polygon")); |
| 248 | + try |
| 249 | + { |
| 250 | + return Locator.findElements(getDriver(), l).stream().filter(WebElement::isDisplayed).count(); |
| 251 | + } |
| 252 | + catch (StaleElementReferenceException e) |
| 253 | + { |
| 254 | + log("Stale elements, retrying"); |
| 255 | + sleep(5000); |
| 256 | + |
| 257 | + return Locator.findElements(getDriver(), l).stream().filter(WebElement::isDisplayed).count(); |
| 258 | + } |
247 | 259 | } |
248 | 260 |
|
249 | 261 | private void testLoadingConfigFilters(){ |
@@ -349,10 +361,8 @@ private Locator.XPathLocator getTrackLocator(String trackId, boolean waitFor) |
349 | 361 | private By getVariantWithinTrack(String trackId, String variantText) |
350 | 362 | { |
351 | 363 | Locator.XPathLocator l = getTrackLocator(trackId, true); |
352 | | - |
353 | | - l = l.append(Locator.xpath("//*[name()='text' and contains(text(), '" + variantText + "')]/..")).notHidden(); |
354 | | - |
355 | 364 | waitForElementToDisappear(Locator.tagWithText("p", "Loading")); |
| 365 | + l = l.append(Locator.xpath("//*[name()='text' and contains(text(), '" + variantText + "')]")).notHidden().append("/.."); |
356 | 366 | waitForElement(l); |
357 | 367 |
|
358 | 368 | return By.xpath(l.toXpath()); |
|
0 commit comments