2323import info .novatec .testit .webtester .pagefragments .annotations .Mapping ;
2424import info .novatec .testit .webtester .pagefragments .annotations .Mark ;
2525import info .novatec .testit .webtester .pagefragments .annotations .As ;
26+ import info .novatec .testit .webtester .pagefragments .utils .EnhancedSelect ;
27+
2628
2729@ Mapping (tag = "select" , attribute = "multiple" )
2830public interface MultiSelect extends GenericSelect <MultiSelect > {
@@ -39,7 +41,7 @@ public interface MultiSelect extends GenericSelect<MultiSelect> {
3941 @ Mark (As .USED )
4042 @ Produces (DeselectedAllEvent .class )
4143 default MultiSelect deselectAll () {
42- new Select (webElement ()).deselectAll ();
44+ new EnhancedSelect (webElement ()).deselectAll ();
4345 return this ;
4446 }
4547
@@ -72,7 +74,7 @@ default MultiSelect deselectByTexts(String... texts) throws NoSuchElementExcepti
7274 @ Mark (As .USED )
7375 @ Produces (DeselectedByTextsEvent .class )
7476 default MultiSelect deselectByTexts (Collection <String > texts ) throws NoSuchElementException {
75- Select select = new Select (webElement ());
77+ Select select = new EnhancedSelect (webElement ());
7678 texts .forEach (select ::deselectByVisibleText );
7779 return this ;
7880 }
@@ -106,7 +108,7 @@ default MultiSelect deselectByValues(String... values) throws NoSuchElementExcep
106108 @ Mark (As .USED )
107109 @ Produces (DeselectedByValuesEvent .class )
108110 default MultiSelect deselectByValues (Collection <String > values ) throws NoSuchElementException {
109- Select select = new Select (webElement ());
111+ Select select = new EnhancedSelect (webElement ());
110112 values .forEach (select ::deselectByValue );
111113 return this ;
112114 }
@@ -140,7 +142,7 @@ default MultiSelect deselectByIndices(Integer... indices) throws NoSuchElementEx
140142 @ Mark (As .USED )
141143 @ Produces (DeselectedByIndicesEvent .class )
142144 default MultiSelect deselectByIndices (Collection <Integer > indices ) throws NoSuchElementException {
143- Select select = new Select (webElement ());
145+ Select select = new EnhancedSelect (webElement ());
144146 indices .forEach (select ::deselectByIndex );
145147 return this ;
146148 }
@@ -174,7 +176,7 @@ default MultiSelect selectByTexts(String... texts) throws NoSuchElementException
174176 @ Mark (As .USED )
175177 @ Produces (SelectedByTextsEvent .class )
176178 default MultiSelect selectByTexts (Collection <String > texts ) throws NoSuchElementException {
177- Select select = new Select (webElement ());
179+ Select select = new EnhancedSelect (webElement ());
178180 texts .forEach (select ::selectByVisibleText );
179181 return this ;
180182 }
@@ -208,7 +210,7 @@ default MultiSelect selectByValues(String... values) throws NoSuchElementExcepti
208210 @ Mark (As .USED )
209211 @ Produces (SelectedByValuesEvent .class )
210212 default MultiSelect selectByValues (Collection <String > values ) throws NoSuchElementException {
211- Select select = new Select (webElement ());
213+ Select select = new EnhancedSelect (webElement ());
212214 values .forEach (select ::selectByValue );
213215 return this ;
214216 }
@@ -242,7 +244,7 @@ default MultiSelect selectByIndices(Integer... indices) throws NoSuchElementExce
242244 @ Mark (As .USED )
243245 @ Produces (SelectedByIndicesEvent .class )
244246 default MultiSelect selectByIndices (Collection <Integer > indices ) throws NoSuchElementException {
245- Select select = new Select (webElement ());
247+ Select select = new EnhancedSelect (webElement ());
246248 indices .forEach (select ::selectByIndex );
247249 return this ;
248250 }
@@ -273,7 +275,7 @@ default List<String> getSelectionTexts() {
273275 */
274276 @ Mark (As .READ )
275277 default Stream <String > streamSelectionTexts () {
276- return new Select (webElement ()).getAllSelectedOptions ().stream ().map (WebElement ::getText );
278+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ().stream ().map (WebElement ::getText );
277279 }
278280
279281 /**
@@ -302,7 +304,7 @@ default List<String> getSelectionValues() {
302304 */
303305 @ Mark (As .READ )
304306 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" ));
306308 }
307309
308310 /**
@@ -331,7 +333,7 @@ default List<Integer> getSelectionIndices() {
331333 */
332334 @ Mark (As .READ )
333335 default Stream <Integer > streamSelectionIndices () {
334- return new Select (webElement ()).getAllSelectedOptions ()
336+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ()
335337 .stream ()
336338 .map (option -> option .getAttribute ("index" ))
337339 .map (Integer ::parseInt );
@@ -347,7 +349,7 @@ default Stream<Integer> streamSelectionIndices() {
347349 * @since 2.0
348350 */
349351 default Integer getSelectionCount () {
350- return new Select (webElement ()).getAllSelectedOptions ().size ();
352+ return new EnhancedSelect (webElement ()).getAllSelectedOptions ().size ();
351353 }
352354
353355}
0 commit comments