1
我寫了下面的測試。它看起來像htmlunit mouseOver()函數不工作(我沒有看到popover的HTML代碼)。 我錯過了什麼嗎?我該如何解決這個問題?Htmlunit mouseOver()不會觸發彈出
@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;
}
}