HtmlElement cancel = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Cancelbtn']");
assertNotNull(cancel);
cancel.mouseDown();
DomText text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
assertNotNull(text);
assertEquals("Edit Text", text.getTextContent());
HtmlElement span = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "']");
assertNotNull(span);
assertEquals("rf-ii", span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE));
edit(page, withControlsComponentId, "Another Test String");
HtmlElement ok = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Okbtn']");
assertNotNull(ok);
ok.mouseDown();
text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
assertNotNull(text);
assertEquals("Another Test String", text.getTextContent());
span = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "']");
assertNotNull(span);
String[] classAttribute = span.getAttribute(HtmlConstants.CLASS_ATTRIBUTE).split(" ");
assertThat(Arrays.asList(classAttribute), CoreMatchers.hasItems("rf-ii", "rf-ii-chng"));
edit(page, withControlsComponentId, "Test String");
blur(page);
text = page.getFirstByXPath("//*[@id = '" + withControlsComponentId + "Label']/text()");
assertNotNull(text);
assertEquals("Test String", text.getTextContent());
}