diff --git a/src/main/java/org/jenkinsci/test/acceptance/po/LabelAxis.java b/src/main/java/org/jenkinsci/test/acceptance/po/LabelAxis.java index b8ae969ed..48bbc9fd1 100644 --- a/src/main/java/org/jenkinsci/test/acceptance/po/LabelAxis.java +++ b/src/main/java/org/jenkinsci/test/acceptance/po/LabelAxis.java @@ -1,6 +1,7 @@ package org.jenkinsci.test.acceptance.po; import java.time.Duration; +import org.openqa.selenium.NoSuchElementException; import org.openqa.selenium.WebElement; /** @@ -16,11 +17,25 @@ public void select(String name) { WebElement checkBox = find(by.path(getPath())).findElement(by.xpath(".//input[@name='values' and @json='%s']", name)); if (!checkBox.isDisplayed()) { - // unfold the labels and slaves sub-nodes - find(by.xpath("//div[@class='yahooTree labelAxis-tree']//table[@id='ygtvtableel1']//a")) - .click(); - find(by.xpath("//div[@class='yahooTree labelAxis-tree']//table[@id='ygtvtableel2']//a")) - .click(); + try { + // unfold the labels and slaves sub-nodes + find(by.xpath("(//button[@class='jenkins-button mp-label-axis__button'])[1]")) + .click(); + find(by.xpath("(//button[@class='jenkins-button mp-label-axis__button'])[2]")) + .click(); + } catch (NoSuchElementException e) { + // forward compatibility + } + + try { + // unfold the labels and slaves sub-nodes + find(by.xpath("//div[@class='yahooTree labelAxis-tree']//table[@id='ygtvtableel1']//a")) + .click(); + find(by.xpath("//div[@class='yahooTree labelAxis-tree']//table[@id='ygtvtableel2']//a")) + .click(); + } catch (NoSuchElementException e) { + // backward compatibility + } waitFor().withTimeout(Duration.ofSeconds(3)).until(checkBox::isDisplayed); }