Selenium2Library系列 keywords 之 _SelectElementKeywords 之 unselect_from_list(self, locator, *items)
2015-04-28 22:52
441 查看
def unselect_from_list(self, locator, *items): """Unselects given values from select list identified by locator. As a special case, giving empty list as `*items` will remove all selections. *items try to unselect by value AND by label. It's faster to use 'by index/value/label' functions. 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. """ items_str = items and "option(s) '%s'" % ", ".join(items) or "all options" 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.") if not items: select.deselect_all() return select, options = self._get_select_list_options(select) for item in items: select.deselect_by_value(item) select.deselect_by_visible_text(item)
方法名:unselect_from_list(self, locator, *items)
相似方法:
公共方法 移除所给items的选中状态
接收参数:locator,*labels/*values
18行:使用_get_select_list(self, locator)方法,返回Select对象
相关文章推荐
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 select_from_list(self, locator, *items)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 unselect_from_list_by_value(self, locator, *values)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 select_from_list_by_value(self, locator, *values)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_list_items(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 list_should_have_no_selections(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 _get_select_list_options_selected(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_labels(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 unselect_from_list_by_index(self, locator, *indexes)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 unselect_from_list_by_label(self, locator, *labels)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 list_selection_should_be(self, locator, *items)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 select_all_from_list(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 select_from_list_by_label(self, locator, *labels)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_label(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 page_should_not_contain_list(self, locator, message='', loglevel='INFO')
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之_get_select_list_options(self, select_list_or_locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_value(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 get_selected_list_values(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之 page_should_contain_list(self, locator, message='', loglevel='INFO')
- Selenium2Library系列 keywords 之 _SelectElementKeywords 之_get_select_list(self, locator)
- Selenium2Library系列 keywords 之 _SelectElementKeywords