diff options
-rw-r--r-- | testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java b/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java index dc6a59d360..64023c7d69 100644 --- a/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java +++ b/testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java @@ -25,6 +25,7 @@ import org.openqa.selenium.WebDriverException; import org.openqa.selenium.WebElement; import com.vaadin.testbench.By; +import com.vaadin.testbench.TestBenchElement; import com.vaadin.testbench.elementsbase.ServerClass; @ServerClass("com.vaadin.ui.ComboBox") @@ -86,7 +87,7 @@ public class ComboBoxElement extends AbstractSelectElement { private boolean selectSuggestion(String text) { for (WebElement suggestion : getPopupSuggestionElements()) { if (text.equals(suggestion.getText())) { - suggestion.click(); + clickElement(suggestion); return true; } } @@ -181,7 +182,7 @@ public class ComboBoxElement extends AbstractSelectElement { */ public boolean openNextPage() { try { - getSuggestionPopup().findElement(byNextPage).click(); + clickElement(getSuggestionPopup().findElement(byNextPage)); return true; } catch (WebDriverException e) { // PhantomJS driver can throw WDE instead of the more specific @@ -197,7 +198,7 @@ public class ComboBoxElement extends AbstractSelectElement { */ public boolean openPrevPage() { try { - getSuggestionPopup().findElement(byPrevPage).click(); + clickElement(getSuggestionPopup().findElement(byPrevPage)); return true; } catch (WebDriverException e) { // PhantomJS driver can throw WDE instead of the more specific @@ -275,4 +276,13 @@ public class ComboBoxElement extends AbstractSelectElement { } } } + + private void clickElement(WebElement element) { + if (isFirefox()) { + // Workaround for Selenium/TB and Firefox 45 issue + ((TestBenchElement) (element)).clickHiddenElement(); + } else { + element.click(); + } + } } |