3333 * methods.
3434 */
3535public interface ElementHandle extends JSHandle {
36- class SelectOption {
37- public String value ;
38- public String label ;
39- public Integer index ;
40-
41- public SelectOption withValue (String value ) {
42- this .value = value ;
43- return this ;
44- }
45- public SelectOption withLabel (String label ) {
46- this .label = label ;
47- return this ;
48- }
49- public SelectOption withIndex (int index ) {
50- this .index = index ;
51- return this ;
52- }
53- }
54-
5536 class CheckOptions {
5637 /**
5738 * Whether to bypass the [actionability](./actionability.md) checks. Defaults to {@code false}.
@@ -1007,41 +988,139 @@ default void scrollIntoViewIfNeeded() {
1007988 * [connected](https://developer.mozilla.org/en-US/docs/Web/API/Node/isConnected) to a Document or a ShadowRoot.
1008989 */
1009990 void scrollIntoViewIfNeeded (ScrollIntoViewIfNeededOptions options );
1010- default List <String > selectOption (String value ) {
1011- return selectOption (value , null );
991+ /**
992+ * Returns the array of option values that have been successfully selected.
993+ *
994+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
995+ * element, the method throws an error.
996+ *
997+ * <p> Will wait until all specified options are present in the {@code <select>} element.
998+ *
999+ *
1000+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1001+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1002+ * is considered matching if all specified properties match.
1003+ */
1004+ default List <String > selectOption (String values ) {
1005+ return selectOption (values , null );
10121006 }
1013- default List <String > selectOption (String value , SelectOptionOptions options ) {
1014- String [] values = value == null ? null : new String []{ value };
1015- return selectOption (values , options );
1007+ /**
1008+ * Returns the array of option values that have been successfully selected.
1009+ *
1010+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1011+ * element, the method throws an error.
1012+ *
1013+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1014+ *
1015+ *
1016+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1017+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1018+ * is considered matching if all specified properties match.
1019+ */
1020+ List <String > selectOption (String values , SelectOptionOptions options );
1021+ /**
1022+ * Returns the array of option values that have been successfully selected.
1023+ *
1024+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1025+ * element, the method throws an error.
1026+ *
1027+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1028+ *
1029+ *
1030+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1031+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1032+ * is considered matching if all specified properties match.
1033+ */
1034+ default List <String > selectOption (ElementHandle values ) {
1035+ return selectOption (values , null );
10161036 }
1037+ /**
1038+ * Returns the array of option values that have been successfully selected.
1039+ *
1040+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1041+ * element, the method throws an error.
1042+ *
1043+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1044+ *
1045+ *
1046+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1047+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1048+ * is considered matching if all specified properties match.
1049+ */
1050+ List <String > selectOption (ElementHandle values , SelectOptionOptions options );
1051+ /**
1052+ * Returns the array of option values that have been successfully selected.
1053+ *
1054+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1055+ * element, the method throws an error.
1056+ *
1057+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1058+ *
1059+ *
1060+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1061+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1062+ * is considered matching if all specified properties match.
1063+ */
10171064 default List <String > selectOption (String [] values ) {
10181065 return selectOption (values , null );
10191066 }
1020- default List <String > selectOption (String [] values , SelectOptionOptions options ) {
1021- if (values == null ) {
1022- return selectOption (new SelectOption [0 ], options );
1023- }
1024- return selectOption (Arrays .asList (values ).stream ().map (
1025- v -> new SelectOption ().withValue (v )).toArray (SelectOption []::new ), options );
1026- }
1027- default List <String > selectOption (SelectOption value ) {
1028- return selectOption (value , null );
1029- }
1030- default List <String > selectOption (SelectOption value , SelectOptionOptions options ) {
1031- SelectOption [] values = value == null ? null : new SelectOption []{value };
1032- return selectOption (values , options );
1033- }
1034- default List <String > selectOption (SelectOption [] values ) {
1067+ /**
1068+ * Returns the array of option values that have been successfully selected.
1069+ *
1070+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1071+ * element, the method throws an error.
1072+ *
1073+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1074+ *
1075+ *
1076+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1077+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1078+ * is considered matching if all specified properties match.
1079+ */
1080+ List <String > selectOption (String [] values , SelectOptionOptions options );
1081+ /**
1082+ * Returns the array of option values that have been successfully selected.
1083+ *
1084+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1085+ * element, the method throws an error.
1086+ *
1087+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1088+ *
1089+ *
1090+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1091+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1092+ * is considered matching if all specified properties match.
1093+ */
1094+ default List <String > selectOption (SelectOption values ) {
10351095 return selectOption (values , null );
10361096 }
1037- List <String > selectOption (SelectOption [] values , SelectOptionOptions options );
1038- default List <String > selectOption (ElementHandle value ) {
1039- return selectOption (value , null );
1040- }
1041- default List <String > selectOption (ElementHandle value , SelectOptionOptions options ) {
1042- ElementHandle [] values = value == null ? null : new ElementHandle []{value };
1043- return selectOption (values , options );
1044- }
1097+ /**
1098+ * Returns the array of option values that have been successfully selected.
1099+ *
1100+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1101+ * element, the method throws an error.
1102+ *
1103+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1104+ *
1105+ *
1106+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1107+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1108+ * is considered matching if all specified properties match.
1109+ */
1110+ List <String > selectOption (SelectOption values , SelectOptionOptions options );
1111+ /**
1112+ * Returns the array of option values that have been successfully selected.
1113+ *
1114+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1115+ * element, the method throws an error.
1116+ *
1117+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1118+ *
1119+ *
1120+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1121+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1122+ * is considered matching if all specified properties match.
1123+ */
10451124 default List <String > selectOption (ElementHandle [] values ) {
10461125 return selectOption (values , null );
10471126 }
@@ -1059,6 +1138,36 @@ default List<String> selectOption(ElementHandle[] values) {
10591138 * is considered matching if all specified properties match.
10601139 */
10611140 List <String > selectOption (ElementHandle [] values , SelectOptionOptions options );
1141+ /**
1142+ * Returns the array of option values that have been successfully selected.
1143+ *
1144+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1145+ * element, the method throws an error.
1146+ *
1147+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1148+ *
1149+ *
1150+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1151+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1152+ * is considered matching if all specified properties match.
1153+ */
1154+ default List <String > selectOption (SelectOption [] values ) {
1155+ return selectOption (values , null );
1156+ }
1157+ /**
1158+ * Returns the array of option values that have been successfully selected.
1159+ *
1160+ * <p> Triggers a {@code change} and {@code input} event once all the provided options have been selected. If element is not a {@code <select>}
1161+ * element, the method throws an error.
1162+ *
1163+ * <p> Will wait until all specified options are present in the {@code <select>} element.
1164+ *
1165+ *
1166+ * @param values Options to select. If the {@code <select>} has the {@code multiple} attribute, all matching options are selected, otherwise only the
1167+ * first option matching one of the passed options is selected. String values are equivalent to {@code {value:'string'}}. Option
1168+ * is considered matching if all specified properties match.
1169+ */
1170+ List <String > selectOption (SelectOption [] values , SelectOptionOptions options );
10621171 /**
10631172 * This method waits for [actionability](./actionability.md) checks, then focuses the element and selects all its text
10641173 * content.
0 commit comments