Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_labels(self, locator)

     def get_selected_list_labels(self, locator):
"""Returns the visible labels of selected elements (as a list) from the select list identified by `locator`. Fails if there is no selection. Select list keywords work on both lists and combo boxes. Key attributes for
select lists are `id` and `name`. See `introduction` for details about
locating elements.
"""
select, options = self._get_select_list_options_selected(locator)
if len(options) == 0:
raise ValueError("Select list with locator '%s' does not have any selected values")
return self._get_labels_for_options(options)

方法名:get_selected_list_labels(self, locator)

相似方法:get_selected_list_label(self, locator)

公共方法 返回选中项的labels数组

接收参数:locator

10行:使用_get_select_list_options_selected(self, locator)方法返回Select 元素对象和选中options数组

13行:使用_get_labels_for_options(self, options) 方法返回options的labels数组

使用:

Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_labels(self, locator)

输出结果:

INFO : @{labels} = [ 无逾期 | 无记录(征信空白) | 贷款或贷记卡当前逾期金额>=300元 ]
上一篇:极客日报第 53 期:抖音将代替拼多多成为春晚独家红包合作伙伴;高通正研发 8cx 升级版处理器,对标苹果 M1;DuckDuckGo 日查询量首次突破 1 亿


下一篇:RelativeLayout各个属性