@ SuppressWarnings ( "squid:S2259" ) public void selectedValue ( String expectedPattern ) { String selectedValue = checkSelectedValue ( expectedPattern , 0 , 0 ) ; String reason = NO_ELEMENT_FOUND ; if ( selectedValue == null && getElement ( ) . is ( ) . present ( ) ) { reason = ELEMENT_NOT_SELECT ; } assertNotNull ( reason , selectedValue ) ; assertTrue ( "Selected Value Mismatch: value of '" + selectedValue + DOES_NOT_MATCH_PATTERN + expectedPattern + "'" , selectedValue . matches ( expectedPattern ) ) ; }
Asserts that the element s selected value matches the regular expression pattern provided . If the element isn t present or a select this will constitute a failure same as a mismatch . This information will be logged and recorded with a screenshot for traceability and added debugging support .