Select the option at the given index by examining the "index" attribute. Args: index: The option at this index will be selected Raises: NoSuchElementException: If there is no option with specified index in SELECT
(self, index: int)
| 85 | raise NoSuchElementException(f"Cannot locate option with value: {value}") |
| 86 | |
| 87 | def select_by_index(self, index: int) -> None: |
| 88 | """Select the option at the given index by examining the "index" attribute. |
| 89 | |
| 90 | Args: |
| 91 | index: The option at this index will be selected |
| 92 | |
| 93 | Raises: |
| 94 | NoSuchElementException: If there is no option with specified index in SELECT |
| 95 | """ |
| 96 | match = str(index) |
| 97 | for opt in self.options: |
| 98 | if opt.get_attribute("index") == match: |
| 99 | self._set_selected(opt) |
| 100 | return |
| 101 | raise NoSuchElementException(f"Could not locate element with index {index}") |
| 102 | |
| 103 | def select_by_visible_text(self, text: str) -> None: |
| 104 | """Select all options that display text matching the argument. |