protected String evalXPath(String xpathExpr) throws Exception {
XPath xpath = null;
if (this.document == null) {
return null;
} else if (this.document instanceof HtmlPage) {
xpath = new HtmlUnitXPath(xpathExpr);
} else if (this.document instanceof Document) {
xpath = new DOMXPath(xpathExpr);
} else {
fail("Document type " + this.document.getClass().getName());
}