提交 373b9f7f 编写于 作者: T tfennelly

Make sure all background JS is done executing before querying the DOM

Lots of tests di "stuff" that relies on JS execution and then check for a result in the DOM by querying it. We should check make sure all JS has finished executing before we perform the DOM query.
上级 08010439
......@@ -23,6 +23,7 @@
*/
package com.gargoylesoftware.htmlunit.html;
import com.gargoylesoftware.htmlunit.WebClientUtil;
import com.gargoylesoftware.htmlunit.html.xpath.XPathUtils;
import java.util.List;
......@@ -33,6 +34,7 @@ import java.util.List;
public class DomNodeUtil {
public static <E> List<E> getByXPath(final DomNode domNode, final String xpathExpr) {
WebClientUtil.waitForJSExec(domNode.getPage().getWebClient());
return (List) XPathUtils.getByXPath(domNode, xpathExpr, null);
}
......@@ -41,6 +43,7 @@ public class DomNodeUtil {
}
public static <X> X selectSingleNode(final DomNode domNode, final String xpathExpr) {
WebClientUtil.waitForJSExec(domNode.getPage().getWebClient());
return domNode.<X>getFirstByXPath(xpathExpr);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册