Skip to content

Instantly share code, notes, and snippets.

@rschmukler
Created June 20, 2013 17:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rschmukler/5825005 to your computer and use it in GitHub Desktop.
Save rschmukler/5825005 to your computer and use it in GitHub Desktop.
Browser.select = function(css, val) {
this.element(css).click();
return this.element(css).findElements(By.css('option')).then(function(els) {
for(var i = 0, el; el = els[i]; ++i) {
var element = el;
el.getText().then(function(text) {
if(text == val) {
element.click();
}
});
}
});
};
Browser.select = function(css, val) {
this.element(css).click();
return this.element(css).findElements(By.css('option')).then(function(els) {
for(var i = 0, el; el = els[i]; ++i) {
var functionHandler = function(elCopy) {
return function(text) {
if(text == val)
elCopy.click();
};
};
el.getText().then(functionHandler(el));
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment