23
23
import info .novatec .testit .webtester .pagefragments .annotations .Mapping ;
24
24
import info .novatec .testit .webtester .pagefragments .annotations .Mark ;
25
25
import info .novatec .testit .webtester .pagefragments .annotations .As ;
26
+ import info .novatec .testit .webtester .pagefragments .utils .EnhancedSelect ;
27
+
26
28
27
29
@ Mapping (tag = "select" , attribute = "multiple" )
28
30
public interface MultiSelect extends GenericSelect <MultiSelect > {
@@ -39,7 +41,7 @@ public interface MultiSelect extends GenericSelect<MultiSelect> {
39
41
@ Mark (As .USED )
40
42
@ Produces (DeselectedAllEvent .class )
41
43
default MultiSelect deselectAll () {
42
- new Select (webElement ()).deselectAll ();
44
+ new EnhancedSelect (webElement ()).deselectAll ();
43
45
return this ;
44
46
}
45
47
@@ -72,7 +74,7 @@ default MultiSelect deselectByTexts(String... texts) throws NoSuchElementExcepti
72
74
@ Mark (As .USED )
73
75
@ Produces (DeselectedByTextsEvent .class )
74
76
default MultiSelect deselectByTexts (Collection <String > texts ) throws NoSuchElementException {
75
- Select select = new Select (webElement ());
77
+ Select select = new EnhancedSelect (webElement ());
76
78
texts .forEach (select ::deselectByVisibleText );
77
79
return this ;
78
80
}
@@ -106,7 +108,7 @@ default MultiSelect deselectByValues(String... values) throws NoSuchElementExcep
106
108
@ Mark (As .USED )
107
109
@ Produces (DeselectedByValuesEvent .class )
108
110
default MultiSelect deselectByValues (Collection <String > values ) throws NoSuchElementException {
109
- Select select = new Select (webElement ());
111
+ Select select = new EnhancedSelect (webElement ());
110
112
values .forEach (select ::deselectByValue );
111
113
return this ;
112
114
}
@@ -140,7 +142,7 @@ default MultiSelect deselectByIndices(Integer... indices) throws NoSuchElementEx
140
142
@ Mark (As .USED )
141
143
@ Produces (DeselectedByIndicesEvent .class )
142
144
default MultiSelect deselectByIndices (Collection <Integer > indices ) throws NoSuchElementException {
143
- Select select = new Select (webElement ());
145
+ Select select = new EnhancedSelect (webElement ());
144
146
indices .forEach (select ::deselectByIndex );
145
147
return this ;
146
148
}
@@ -174,7 +176,7 @@ default MultiSelect selectByTexts(String... texts) throws NoSuchElementException
174
176
@ Mark (As .USED )
175
177
@ Produces (SelectedByTextsEvent .class )
176
178
default MultiSelect selectByTexts (Collection <String > texts ) throws NoSuchElementException {
177
- Select select = new Select (webElement ());
179
+ Select select = new EnhancedSelect (webElement ());
178
180
texts .forEach (select ::selectByVisibleText );
179
181
return this ;
180
182
}
@@ -208,7 +210,7 @@ default MultiSelect selectByValues(String... values) throws NoSuchElementExcepti
208
210
@ Mark (As .USED )
209
211
@ Produces (SelectedByValuesEvent .class )
210
212
default MultiSelect selectByValues (Collection <String > values ) throws NoSuchElementException {
211
- Select select = new Select (webElement ());
213
+ Select select = new EnhancedSelect (webElement ());
212
214
values .forEach (select ::selectByValue );
213
215
return this ;
214
216
}
@@ -242,7 +244,7 @@ default MultiSelect selectByIndices(Integer... indices) throws NoSuchElementExce
242
244
@ Mark (As .USED )
243
245
@ Produces (SelectedByIndicesEvent .class )
244
246
default MultiSelect selectByIndices (Collection <Integer > indices ) throws NoSuchElementException {
245
- Select select = new Select (webElement ());
247
+ Select select = new EnhancedSelect (webElement ());
246
248
indices .forEach (select ::selectByIndex );
247
249
return this ;
248
250
}
@@ -273,7 +275,7 @@ default List<String> getSelectionTexts() {
273
275
*/
274
276
@ Mark (As .READ )
275
277
default Stream <String > streamSelectionTexts () {
276
- return new Select (webElement ()).getAllSelectedOptions ().stream ().map (WebElement ::getText );
278
+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ().stream ().map (WebElement ::getText );
277
279
}
278
280
279
281
/**
@@ -302,7 +304,7 @@ default List<String> getSelectionValues() {
302
304
*/
303
305
@ Mark (As .READ )
304
306
default Stream <String > streamSelectionValues () {
305
- return new Select (webElement ()).getAllSelectedOptions ().stream ().map (option -> option .getAttribute ("value" ));
307
+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ().stream ().map (option -> option .getAttribute ("value" ));
306
308
}
307
309
308
310
/**
@@ -331,7 +333,7 @@ default List<Integer> getSelectionIndices() {
331
333
*/
332
334
@ Mark (As .READ )
333
335
default Stream <Integer > streamSelectionIndices () {
334
- return new Select (webElement ()).getAllSelectedOptions ()
336
+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ()
335
337
.stream ()
336
338
.map (option -> option .getAttribute ("index" ))
337
339
.map (Integer ::parseInt );
@@ -347,7 +349,7 @@ default Stream<Integer> streamSelectionIndices() {
347
349
* @since 2.0
348
350
*/
349
351
default Integer getSelectionCount () {
350
- return new Select (webElement ()).getAllSelectedOptions ().size ();
352
+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ().size ();
351
353
}
352
354
353
355
}
0 commit comments