Skip to content

Instantly share code, notes, and snippets.

@djfm
Created March 24, 2016 15:21
Show Gist options
  • Save djfm/921d3f5d201f31cae23b to your computer and use it in GitHub Desktop.
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
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