public void click ( ) { String cantClick = "Unable to click " ; String action = "Clicking " + prettyOutput ( ) ; String expected = prettyOutputStart ( ) + " is present, displayed, and enabled to be clicked" ; try { if ( isNotPresentDisplayedEnabled ( action , expected , cantClick ) ) { return ; } WebElement webElement = getWebElement ( ) ; webElement . click ( ) ; } catch ( Exception e ) { reporter . fail ( action , expected , cantClick + prettyOutputEnd ( ) + e . getMessage ( ) ) ; log . warn ( e ) ; return ; } reporter . pass ( action , expected , "Clicked " + prettyOutputEnd ( ) . trim ( ) ) ; }
Clicks on the element but only if the element is present displayed and enabled . If those conditions are not met the click action will be logged but skipped and the test will continue .