Selenium2Library系列 keywords 之 _SelectElementKeywords 之 unselect_from_list_by_label(self, locator, *labels)

     def unselect_from_list_by_label(self, locator, *labels):
"""Unselects `*labels` from list identified by `locator` 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.
"""
if not labels:
raise ValueError("No value given.")
items_str = "label(s) '%s'" % ", ".join(labels)
self._info("Unselecting %s from list '%s'." % (items_str, locator)) select = self._get_select_list(locator)
if not select.is_multiple:
raise RuntimeError("Keyword 'Unselect from list' works only for multiselect lists.") for label in labels:
select.deselect_by_visible_text(label)

方法名:unselect_from_list_by_label(self, locator, *labels)

相似方法:

公共方法 移除所给labels的选中状态

接收参数:locator,labels

13行:使用_get_select_list(self, locator)方法,返回Select对象

上一篇:springboot情操陶冶-@ConfigurationProperties注解解析


下一篇:Selenium2Library系列 keywords 之 _SelectElementKeywords 之 list_should_have_no_selections(self, locator)