Topic
9 replies Latest Post - ‏2013-11-04T16:22:19Z by RFTworker
RFTworker
RFTworker
66 Posts
ACCEPTED ANSWER

Pinned topic Msgbox in RFT

‏2013-10-17T15:28:16Z |

Is there a way that i can insert a Message box with some info in it in middle of the script and if i hit okay, it continues playback again? just like msgbox in QTP....

 

Please let me know.Thanks

 

  • cagin.uludamar
    cagin.uludamar
    66 Posts
    ACCEPTED ANSWER

    Re: Msgbox in RFT

    ‏2013-10-21T12:45:57Z  in response to RFTworker

    I needed same functionality too. But I had to tell script users to set a breakpoint in the script and run the script in debug mode. When the breakpoint is hit, execution stops. User takes actions and continues the script.

    • TonyNGAN
      TonyNGAN
      34 Posts
      ACCEPTED ANSWER

      Re: Msgbox in RFT

      ‏2013-10-27T11:40:45Z  in response to cagin.uludamar

      Hi Cagin,

      I can say the pause(); function is not available in RFT 8.3...

      But I have used another way to pause the playback by script:

      The answer is using Java Robot and here are the script:

      try{
       java.awt.Robot r =  newjava.awt.Robot();
       r.keypress(keyEvent.VK_F12);
       r.keyrelease(keyEvent.VK_F12);
       sleep(5);  //You must sleep the RFT, if not, the keypress event will not affect (maybe it runs the script too fast...)
      } catch(Exception e) {
           e.printStackTrace();
      }

      The above script theory is using Java robot to press F12, for RFT, F12 is the hotkey to stop the playback in anytime.

      Please note that you need to import keypress and keyevent for the script.

      Hope this can help you to pause the script

      Sorry that I also can't help on the Msgbox

      Regards

      Tony

  • OttoDiesel
    OttoDiesel
    51 Posts
    ACCEPTED ANSWER

    Re: Msgbox in RFT

    ‏2013-10-22T07:52:59Z  in response to RFTworker

    I think you could write a Swing or SWT message box for this purpose.

    You can code it so that the test script execution is paused until the user clicks OK button.

    But there is maybe a better option. You can pause the execution. It is the same as if you would click on the pause icon in the RFT playback monitor.

    You could try RFTCore.getScriptExecutionArgs().getScriptPlaybackMonitor() and call the pause method when starting the message box and continuing play when the user clicks the OK button.

  • Newbie07
    Newbie07
    14 Posts
    ACCEPTED ANSWER

    Re: Msgbox in RFT

    ‏2013-10-29T06:50:04Z  in response to RFTworker

    Hi RFTworker,

    I'am not sure! But as far as I know, there is no such inbuilt function/method in RFT. :(

    But (if you are using Java scripting), you can use below line:

    JOptionPane.showMessageDialog(null,"This is pop up message");

    This will prompt a message box on the screen. And when you hit 'OK' button, you can proceed with rest of script execution.

  • MrCoolK
    MrCoolK
    53 Posts
    ACCEPTED ANSWER

    Re: Msgbox in RFT

    ‏2013-10-29T12:18:07Z  in response to RFTworker

    Try this.

    This  will work

    String message="Your message here";

     JOptionPane pane = new JOptionPane(message);
        JDialog dialog = pane.createDialog(new JFrame()"Dilaog");
        dialog.show();

     

    this will make the script stop and will only playback if you press ok

     

    Thanks

    Cool K

    Updated on 2013-10-30T12:05:09Z at 2013-10-30T12:05:09Z by MrCoolK
    • RFTworker
      RFTworker
      66 Posts
      ACCEPTED ANSWER

      Re: Msgbox in RFT

      ‏2013-11-04T16:20:02Z  in response to MrCoolK

      Thanks everyone for your responses. I have tried the solution from MrcoolK and it worked! thanks again!!