Created
June 20, 2013 17:55
-
-
Save rschmukler/5825005 to your computer and use it in GitHub Desktop.
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.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(); | |
} | |
}); | |
} | |
}); | |
}; |
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.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