public static void typeAlloyEditor(WebDriver webDriver, String locator, String value) { WebElement webElement = getWebElement(webDriver, locator); WrapsDriver wrapsDriver = (WrapsDriver) webElement; WebDriver wrappedWebDriver = wrapsDriver.getWrappedDriver(); JavascriptExecutor javascriptExecutor = (JavascriptExecutor) wrappedWebDriver; StringBuilder sb = new StringBuilder(); sb.append("CKEDITOR.instances[\""); String titleAttribute = getAttribute(webDriver, locator + "@title"); int x = titleAttribute.indexOf(","); int y = titleAttribute.indexOf(",", x + 1); if (y == -1) { y = titleAttribute.length(); } sb.append(titleAttribute.substring(x + 2, y)); sb.append("\"].setData(\""); sb.append(HtmlUtil.escapeJS(value.replace("\\", "\\\\"))); sb.append("\");"); javascriptExecutor.executeScript(sb.toString()); }
public static void typeEditor(WebDriver webDriver, String locator, String value) { WrapsDriver wrapsDriver = (WrapsDriver) getWebElement(webDriver, locator); JavascriptExecutor javascriptExecutor = (JavascriptExecutor) wrapsDriver.getWrappedDriver(); StringBuilder sb = new StringBuilder(); sb.append("CKEDITOR.instances[\""); sb.append(getEditorName(webDriver, locator)); sb.append("\"].setData(\""); sb.append(HtmlUtil.escapeJS(value.replace("\\", "\\\\"))); sb.append("\");"); javascriptExecutor.executeScript(sb.toString()); }
public static void typeFrame(LiferaySelenium liferaySelenium, String locator, String value) { StringBuilder sb = new StringBuilder(); String titleAttribute = liferaySelenium.getAttribute(locator + "@title"); int x = titleAttribute.indexOf(","); int y = titleAttribute.indexOf(",", x + 1); if (y == -1) { y = titleAttribute.length(); } sb.append(titleAttribute.substring(x + 1, y)); sb.append(".setHTML(\""); sb.append(HtmlUtil.escapeJS(value.replace("\\", "\\\\"))); sb.append("\")"); liferaySelenium.runScript(sb.toString()); }