|
11 | 11 | class SingleSelect(BaseControl):
|
12 | 12 | """
|
13 | 13 | Entity-Component: SingleSelect
|
14 |
| - Select Javascript framework: select2 |
| 14 | +
|
15 | 15 | A dropdown which can select only one value
|
16 | 16 | """
|
17 | 17 | def __init__(self, browser, container, searchable=True, allow_new_values=False):
|
@@ -114,17 +114,19 @@ def search_get_list(self, value):
|
114 | 114 | searched_values = list(self._list_visible_values())
|
115 | 115 | else:
|
116 | 116 | self.wait_for_search_list()
|
117 |
| - searched_values = list(self._list_visible_values()) |
| 117 | + searched_values = list(self._list_visible_values(open_dropdown=False)) |
118 | 118 | self.input.send_keys(Keys.ESCAPE)
|
119 | 119 | self.wait_for("container")
|
120 | 120 | return searched_values
|
121 | 121 |
|
122 |
| - def _list_visible_values(self): |
| 122 | + def _list_visible_values(self, open_dropdown=True): |
123 | 123 | """
|
124 | 124 | Gets list of values which are visible. Used while filtering
|
| 125 | + :param open_dropdown: Whether or not the dropdown should be opened |
125 | 126 | :returns: List of the values that are visible
|
126 | 127 | """
|
127 |
| - self.dropdown.click() |
| 128 | + if open_dropdown: |
| 129 | + self.dropdown.click() |
128 | 130 | if self.allow_new_values:
|
129 | 131 | popoverid = '#' + self.combobox.get_attribute("data-test-popover-id")
|
130 | 132 | self.elements.update({
|
@@ -286,7 +288,7 @@ def wait_for_search_list(self):
|
286 | 288 | Wait for SingleSelect search to populate
|
287 | 289 | """
|
288 | 290 | def _wait_for_search_list(driver):
|
289 |
| - return len(list(self._list_visible_values())) > 0 |
| 291 | + return len(list(self._list_visible_values(open_dropdown=False))) > 0 |
290 | 292 | self.wait_for(_wait_for_search_list, msg="No values found in SingleSelect search")
|
291 | 293 |
|
292 | 294 | def is_editable(self):
|
|
0 commit comments