Created
March 24, 2016 15:21
-
-
Save djfm/921d3f5d201f31cae23b to your computer and use it in GitHub Desktop.
Useful webdriver.io command to wait for things in the browser's JS execution environment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
browser.addCommand('waitForBrowserSide', function waitForBrowserSide (callback) { | |
return browser | |
.timeoutsAsyncScript(10000) | |
.executeAsync(function thisRunsInsideTheBrowser(callback, done) { | |
setInterval(function () { | |
if (callback()) { | |
done(); | |
} | |
}, 100); | |
}, callback) | |
; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment