def select_all_from_list(self, locator):
"""Selects all values from multi-select list identified by `id`. Key attributes for lists are `id` and `name`. See `introduction` for
details about locating elements.
"""
self._info("Selecting all options from list '%s'." % locator) select = self._get_select_list(locator)
if not select.is_multiple:
raise RuntimeError("Keyword 'Select all from list' works only for multiselect lists.") for i in range(len(select.options)):
select.select_by_index(i)
方法名:select_all_from_list(self, locator)
公共方法 选中所有选项,适用于multi-select list
接收参数:locator
9行:使用_get_select_list(self, locator)方法,返回Select对象
13、14行:遍历所有options,并选中
使用:
输出结果:
INFO : Selecting all options from list 'id=creOutTime'.