def _find_options(self, how, term):
types = [six.text_type, six.binary_type, int, re._pattern_type]
found = []
def func(sel):
if type(term) in types:
collection = sel.options(value=term) if how == 'value' else []
if not list(collection):
collection = sel.options(text=term)
if not list(collection):
collection = sel.options(label=term)
if collection:
found.append(collection)
return False
else:
return not found and nerodia.relaxed_locate
else:
raise TypeError('expected {!r}, got {}:{}'.format(types, term, term.__class__))
try:
Wait.until_not(func, object=self)
if found:
return found[0]
raise NoValueFoundException('{} not found in select list'.format(term))
except TimeoutError:
raise NoValueFoundException('{} not found in select list'.format(term))
评论列表
文章目录