- assigned_to: nobody --> jevonwright
New method moveFocusToElementByXPath would enable setting the focus to the specified element, as supported by the HtmlUnit method WebClient.moveFocusToElement().
This would enable the testing of onfocus and onblur events.
Needs new method in HtmlUnitDialog, something like this:
public void moveFocusToElementByXPath(String xpath) {
HtmlElement e = getElementByXPath(xpath);
if (e == null)
throw new RuntimeException("No element found with xpath \"" + xpath + "\"");
try {
FocusableElement fe = (FocusableElement) e;
wc.moveFocusToElement(fe);
} catch (ClassCastException exp) {
throw new RuntimeException("Element with xpath \"" + xpath + "\" is not focusable", exp);
} catch (IOException exp) {
throw new RuntimeException("Move focus failed", exp);
}
}
Also needs corresponding method on WebTestCase.