Skip to content

Instantly share code, notes, and snippets.

@gregwym
Last active August 29, 2015 14:02
Show Gist options
  • Save gregwym/a34479a4084be3ecc51c to your computer and use it in GitHub Desktop.
Save gregwym/a34479a4084be3ecc51c to your computer and use it in GitHub Desktop.
Add element.isShown method to admc/wd Node.js webdriver.
wd.addElementAsyncMethod('isShown', function isShown () {
var cb = wd.findCallback(arguments);
var el = this;
return el.getComputedCss('display', function(err, display) {
if (err) cb(err);
return el.getComputedCss('visibility', function(err, visibility) {
if (err) cb(err);
cb(null, display !== 'none' && visibility !== 'hidden');
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment