private void setTargetContent( final long rowIndex, final String text, final String idFormat, final Plurals plural) { WebElement we = readyElement(By.id(String.format(idFormat, rowIndex, plural.index()))); we.click(); we.clear(); we.sendKeys(text); }
private String getCodeMirrorContent( final long rowIndex, final String idFormat, final Plurals plurals) { return waitForAMoment() .until( (Function<WebDriver, String>) webDriver -> { // code mirror will turn text into list of <pre>. List<WebElement> cmTextLines = webDriver .findElement(By.id(String.format(idFormat, rowIndex, plurals.index()))) .findElements(By.tagName("pre")); List<String> contents = WebElementUtil.elementsToText(cmTextLines); return Joiner.on("\n").skipNulls().join(contents); }); }
private String getContentAtRowIndex( final long rowIndex, final String idFormat, final Plurals plural) { return readyElement(By.id(String.format(idFormat, rowIndex, plural.index()))) .getAttribute("value"); }