|
35 | 35 |
|
36 | 36 | import org.apache.commons.logging.Log; |
37 | 37 | import org.apache.commons.logging.LogFactory; |
38 | | -import org.openqa.selenium.ElementNotVisibleException; |
39 | 38 | import org.openqa.selenium.JavascriptExecutor; |
40 | 39 | import org.openqa.selenium.Keys; |
41 | 40 | import org.openqa.selenium.WebDriver; |
42 | 41 | import org.openqa.selenium.WebDriverException; |
43 | 42 | import org.openqa.selenium.WebElement; |
44 | | -import org.openqa.selenium.firefox.FirefoxDriver; |
45 | 43 | import org.openqa.selenium.htmlunit.HtmlUnitDriver; |
46 | 44 | import org.openqa.selenium.support.ui.Select; |
47 | 45 |
|
@@ -117,7 +115,7 @@ private static void changeElementValue(WebDriver driver, WebElement element, Str |
117 | 115 | changeValueOfInputElement(element, value); |
118 | 116 | } else if (isOptionTag(element)) { |
119 | 117 | warnAboutNotChangingValueOfElement("<option>", "#myOption"); |
120 | | - } else if (isContentEditable(element)) { |
| 118 | + } else if (isContentEditable(driver, element)) { |
121 | 119 | changeValueOfContentEditableElement(driver, element, value); |
122 | 120 | } else { |
123 | 121 | changeValueOfUnknownElement(element, value); |
@@ -156,18 +154,6 @@ private static void changeValueOfContentEditableElement(WebDriver driver, WebEle |
156 | 154 | // #Cross-Driver |
157 | 155 | if (DriverVersionUtils.getInstance().isHtmlUnitDriver(driver)) { |
158 | 156 | changeContentEditableValueInHtmlUnit(driver, element, value); |
159 | | - } else if (driver instanceof FirefoxDriver) { |
160 | | - // #Cross-Driver |
161 | | - // in firefox, an editable div cannot be empty |
162 | | - try { |
163 | | - selectAllText(element); |
164 | | - element.sendKeys(value); |
165 | | - } catch (ElementNotVisibleException e) { |
166 | | - // we could work it out, possibly via JavaScript, but we decided not to, as the END USER would not be able to edit it as well! |
167 | | - throw new ElementNotVisibleException("Empty contenteditable elements are not visible in Firefox, " + |
168 | | - "so a user can't directly interact with them. Try picking an element before the contenteditable one " + |
169 | | - "and sending the TAB key to it, so the focus is switched, and then try calling .val() to change its value.", e); |
170 | | - } |
171 | 157 | } else { |
172 | 158 | element.clear(); |
173 | 159 | element.sendKeys(value); |
|
0 commit comments