Skip to content
This repository was archived by the owner on Jan 17, 2020. It is now read-only.

Commit 185fb96

Browse files
committed
wait fix
1 parent 0205065 commit 185fb96

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/Selenium.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,17 @@ exports.wait = function(check) {
1616
return function(driver) {
1717
return function(cb, eb) {
1818
var p = new webdriver.promise.Promise(check);
19-
driver.wait(p, timeout).then(cb).thenCatch(eb);
19+
driver.wait(p, timeout)
20+
.then(function() {
21+
p.then(function(res) {
22+
if (res) {
23+
cb();
24+
} else {
25+
eb(new Error("wait promise has returned false"));
26+
}
27+
}).thenCatch(eb);
28+
})
29+
.thenCatch(eb);
2030
};
2131
};
2232
};

0 commit comments

Comments
 (0)