1 def get_selected_list_values(self, locator): 2 """Returns the values of selected elements (as a list) from the select list identified by `locator`. 3 4 Fails if there is no selection. 5 6 Select list keywords work on both lists and combo boxes. Key attributes for 7 select lists are `id` and `name`. See `introduction` for details about 8 locating elements. 9 """ 10 select, options = self._get_select_list_options_selected(locator) 11 if len(options) == 0: 12 raise ValueError("Select list with locator '%s' does not have any selected values") 13 return self._get_values_for_options(options)
方法名:get_selected_list_values(self, locator)
相似方法:
公共方法 返回所有选中项的values数组
接收参数:locator
10行:使用_get_select_list_options_selected(self, locator)方法返回Select 元素对象和选中options数组
13行:返回所有选中项的value数组
使用:
输出结果:
INFO : @{values} = [ 0 | 1 | 2 ]