码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2015-04-26 16:27:11      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

 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 ]

 

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

标签:

原文地址:http://www.cnblogs.com/loveok-56/p/4457850.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!