public void typeIntoPrompt ( String text ) { String action = "Typing text '" + text + "' into prompt" ; String expected = "Prompt is present and enabled to have text " + text + " typed in" ; if ( isNotPrompt ( action , expected , "type into" ) ) { return ; } try { Alert alert = driver . switchTo ( ) . alert ( ) ; alert . sendKeys ( text ) ; } catch ( Exception e ) { reporter . fail ( action , expected , "Unable to type into prompt. " + e . getMessage ( ) ) ; log . warn ( e ) ; return ; } reporter . pass ( action , expected , "Typed text '" + text + "' into prompt" ) ; }
Type text into a prompt box