Skip to content

Instantly share code, notes, and snippets.

@rdpanek
Created March 20, 2018 22:49
Show Gist options
  • Save rdpanek/374f0d8a2d8cd6e59b628fee56d51727 to your computer and use it in GitHub Desktop.
Save rdpanek/374f0d8a2d8cd6e59b628fee56d51727 to your computer and use it in GitHub Desktop.
wait for clickable wdio
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