diff --git a/src/Selenium2Library/keywords/_selectelement.py b/src/Selenium2Library/keywords/_selectelement.py index df6405211..261ead020 100644 --- a/src/Selenium2Library/keywords/_selectelement.py +++ b/src/Selenium2Library/keywords/_selectelement.py @@ -186,6 +186,8 @@ def select_from_list(self, locator, *items): try: option_index = option_labels.index(item) except: continue select_func(select, options, option_index) + if option_index is None: + raise ValueError("%s doesn't exist in list '%s'." % (items_str, locator)) def unselect_from_list(self, locator, *items): """Unselects given values from select list identified by locator. @@ -219,6 +221,8 @@ def unselect_from_list(self, locator, *items): try: option_index = option_labels.index(item) except: continue self._unselect_option_from_multi_select_list(select, options, option_index) + if option_index is None: + raise ValueError("%s doesn't exist in list '%s'." % (items_str, locator)) # Private