selenium command "chooseCancelOnNextConfirmation" and "chooseOkOnNextConfirmation" with example

"chooseCancelOnNextConfirmation" command

"chooseCancelOnNextConfirmation" command used with confirmation popup box. When you are performing some major action like deleting records at that place you can see this kind of confirmation message box to proceed or to cancel the process. "chooseCancelOnNextConfirmation" command will click on cancel button on this kind of action.

Here is the example of "chooseCancelOnNextConfirmation" command.In bellow given example, selenium will click on cancel button of confirmation box. Here it is predefined action to perform on next command.

New Test
CommandTargetValue
openhttp://www.w3schools.com/ js/tryit.asp?filename =tryjs_confirm
selectFrameview
chooseCancelOnNext Confirmation

click css=button
assertConfirmation Press a button!

"chooseOkOnNextConfirmation" command


"chooseOkOnNextConfirmation" command will click on Ok button on next confirmation box. see bellow given example for better understanding

New Test
CommandTargetValue
openhttp://www.w3schools.com/ js/tryit.asp?filename =tryjs_confirm
selectFrameview
chooseOkOnNext Confirmation

click css=button
assertConfirmation Press a button!

4 comments:



  1. when i am using following commands in selenium IDE then it reporting an error "[error] There was an unexpected Confirmation! [Press a button!]". how can i properly handle this 'cancel' button of confirm model using 'chooseCancelOnNextConfirmation' command. and please describe how it is working?

    ReplyDelete
  2. Hello

    i want to apply storeConfirmationPresent command but it shows false always as there is already confirmation called. so please can you help me to apply it properly.

    Best Regards
    Jignesh

    ReplyDelete
  3. alert box not showing-why?

    ReplyDelete
    Replies
    1. When your selenium IDE window is open, It will not show you confirmation box.

      Delete