@ SuppressWarnings ( "squid:S1168" ) public String [ ] selectOptions ( ) { if ( isNotPresentSelect ( ) ) { return null ; // returning an empty array could be confused with no options available } WebElement webElement = element . getWebElement ( ) ; Select dropdown = new Select ( webElement ) ; List < WebElement > options = dropdown . getOptions ( ) ; String [ ] stringOptions = new String [ options . size ( ) ] ; for ( int i = 0 ; i < options . size ( ) ; i ++ ) { stringOptions [ i ] = options . get ( i ) . getText ( ) ; } return stringOptions ; }
Retrieves the select options in the element . If the element isn t present or a select a null value will be returned .