Created
March 20, 2018 22:49
-
-
Save rdpanek/374f0d8a2d8cd6e59b628fee56d51727 to your computer and use it in GitHub Desktop.
wait for clickable wdio
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("waitForClickable", function(selector) { | |
browser.waitUntil( | |
function() { | |
try { | |
return browser.execute(function(selector) { | |
return document | |
.evaluate( | |
selector, | |
document, | |
null, | |
XPathResult.FIRST_ORDERED_NODE_TYPE, | |
null | |
) | |
.singleNodeValue.click(); | |
}, selector); | |
} catch (e) { | |
console.log(e); | |
} | |
}, | |
"element isn't clickable", | |
3000, | |
500 | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment