Browse Source

Add Firefox 45 workaround in ComboBoxElement (#8449)

tags/8.0.0.rc1
Henri Sara 7 years ago
parent
commit
6e80f676f4

+ 13
- 3
testbench-api/src/main/java/com/vaadin/testbench/elements/ComboBoxElement.java View File

import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;


import com.vaadin.testbench.By; import com.vaadin.testbench.By;
import com.vaadin.testbench.TestBenchElement;
import com.vaadin.testbench.elementsbase.ServerClass; import com.vaadin.testbench.elementsbase.ServerClass;


@ServerClass("com.vaadin.ui.ComboBox") @ServerClass("com.vaadin.ui.ComboBox")
private boolean selectSuggestion(String text) { private boolean selectSuggestion(String text) {
for (WebElement suggestion : getPopupSuggestionElements()) { for (WebElement suggestion : getPopupSuggestionElements()) {
if (text.equals(suggestion.getText())) { if (text.equals(suggestion.getText())) {
suggestion.click();
clickElement(suggestion);
return true; return true;
} }
} }
*/ */
public boolean openNextPage() { public boolean openNextPage() {
try { try {
getSuggestionPopup().findElement(byNextPage).click();
clickElement(getSuggestionPopup().findElement(byNextPage));
return true; return true;
} catch (WebDriverException e) { } catch (WebDriverException e) {
// PhantomJS driver can throw WDE instead of the more specific // PhantomJS driver can throw WDE instead of the more specific
*/ */
public boolean openPrevPage() { public boolean openPrevPage() {
try { try {
getSuggestionPopup().findElement(byPrevPage).click();
clickElement(getSuggestionPopup().findElement(byPrevPage));
return true; return true;
} catch (WebDriverException e) { } catch (WebDriverException e) {
// PhantomJS driver can throw WDE instead of the more specific // PhantomJS driver can throw WDE instead of the more specific
} }
} }
} }

private void clickElement(WebElement element) {
if (isFirefox()) {
// Workaround for Selenium/TB and Firefox 45 issue
((TestBenchElement) (element)).clickHiddenElement();
} else {
element.click();
}
}
} }

Loading…
Cancel
Save