Skip to content

Commit bb13f6d

Browse files
committed
Fixing error code returned by xpath finder if the document is lot loaded yet
1 parent d920111 commit bb13f6d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Diff for: javascript/atoms/locators/xpath.js

+5
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ bot.locators.xpath.DEFAULT_RESOLVER_ = (function() {
8888
bot.locators.xpath.evaluate_ = function(node, path, resultType) {
8989
var doc = goog.dom.getOwnerDocument(node);
9090

91+
if (!doc.documentElement) {
92+
// document is not loaded yet
93+
return null;
94+
}
95+
9196
// Let the wgxpath library be compiled away unless we are on IE or Android.
9297
// TODO: Restrict this to just IE when we drop support for Froyo.
9398
if (goog.userAgent.IE || goog.userAgent.product.ANDROID) {

0 commit comments

Comments
 (0)