public String [ ] getSelectedValues ( ) { List < WebElement > options = getElement ( ) . findElements ( By . tagName ( "option" ) ) ; List < String > selected = new ArrayList < String > ( ) ; for ( WebElement option : options ) { if ( option . isSelected ( ) ) { selected . add ( option . getAttribute ( "value" ) ) ; } } return ( String [ ] ) selected . toArray ( new String [ selected . size ( ) ] ) ; }
Gets multiple selected values .