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

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

时间:2015-04-29 00:25:09      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:

 1     def list_should_have_no_selections(self, locator):
 2         """Verifies select list identified by `locator` has no selections.
 3 
 4         Select list keywords work on both lists and combo boxes. Key attributes for
 5         select lists are `id` and `name`. See `introduction` for details about
 6         locating elements.
 7         """
 8         self._info("Verifying list ‘%s‘ has no selection." % locator)
 9         select, options = self._get_select_list_options_selected(locator)
10         if options:
11             selected_labels = self._get_labels_for_options(options)
12             items_str = " | ".join(selected_labels)
13             raise AssertionError("List ‘%s‘ should have had no selection "
14                                  "(selection was [ %s ])" % (locator, items_str))

方法名:list_should_have_no_selections(self, locator)

公共方法 验证select list 没有项被选中

接收参数:locator

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

11行:使用_get_labels_for_options(self, options)返回选中options的labels数组

使用:

技术分享

输出结果:

INFO : Verifying list id=creOutTime has no selection.

 

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

标签:

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

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