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)
更多文章、技術交流、商務合作、聯(lián)系博主
微信掃碼或搜索:z360901061
微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元

