@@ -85,16 +85,15 @@ def select_by_value(self, value: str) -> None:
85
85
86
86
def select_by_index (self , index : int ) -> None :
87
87
"""Select the option at the given index. This is done by examining the
88
- "index" attribute of an element, and not merely by counting.
88
+ "index" property of an element, and not merely by counting.
89
89
90
90
:Args:
91
91
- index - The option at this index will be selected
92
92
93
93
throws NoSuchElementException If there is no option with specified index in SELECT
94
94
"""
95
- match = str (index )
96
95
for opt in self .options :
97
- if opt .get_attribute ("index" ) == match :
96
+ if opt .get_property ("index" ) == index :
98
97
self ._set_selected (opt )
99
98
return
100
99
raise NoSuchElementException (f"Could not locate element with index { index } " )
@@ -172,7 +171,7 @@ def deselect_by_value(self, value: str) -> None:
172
171
173
172
def deselect_by_index (self , index : int ) -> None :
174
173
"""Deselect the option at the given index. This is done by examining
175
- the "index" attribute of an element, and not merely by counting.
174
+ the "index" property of an element, and not merely by counting.
176
175
177
176
:Args:
178
177
- index - The option at this index will be deselected
@@ -182,7 +181,7 @@ def deselect_by_index(self, index: int) -> None:
182
181
if not self .is_multiple :
183
182
raise NotImplementedError ("You may only deselect options of a multi-select" )
184
183
for opt in self .options :
185
- if opt .get_attribute ("index" ) == str ( index ) :
184
+ if opt .get_property ("index" ) == index :
186
185
self ._unset_selected (opt )
187
186
return
188
187
raise NoSuchElementException (f"Could not locate element with index { index } " )
0 commit comments