1

我写了以下测试。看起来 htmlunit mouseOver() 函数不起作用(我没有看到弹出框的 html 代码)。我错过了什么吗?我该如何解决这个问题?

@Test
public void test() throws Exception {
    try {

        WebClient client = new WebClient(BrowserVersion.FIREFOX_3_6);
        HtmlPage currentPage = client.getPage("http://plugins.learningjquery.com/cluetip/demo/");
        String xpath = "//a[@title='jTip Style!']";
        HtmlElement elm = (HtmlElement) currentPage.getByXPath(xpath).get(0);
        xpath = "(//img[@src='kids-drop-sand.jpg'])[1]";
        HtmlPage newPage = (HtmlPage) elm.mouseOver();
        Assert.assertTrue(newPage.getByXPath(xpath).size() > 0, "Popover is not displayed");

    } catch (Exception ex) {
        logger.error("Exception thrown in " + this.getClass().toString()
                + " " + ex.getMessage(), ex);
        throw ex;
    }
}
4

1 回答 1

0

你试过最新的 svn 吗?
http://htmlunit.sourceforge.net/gettingLatestCode.html

或最后一次成功构建: http ://build.canoo.com/htmlunit/buildresults?log=log20120530150012Lbuild.1963

可用的最新版本相当陈旧,对 JS 事件的管理很差。

于 2012-06-01T08:48:56.503 回答