public String getSelectedValue ( final By by ) { Select select = new Select ( driver . findElement ( by ) ) ; String defaultSelectedValue = select . getFirstSelectedOption ( ) . getText ( ) ; return defaultSelectedValue ; }
Returns the first selected value from a drop down list .