Forum Discussion

kcoffrin's avatar
kcoffrin
Contributor
10 years ago

MessageDLG: Capture On Click Event

I have created a simple login Userform with some basic validation on the username and password fields(using hardcoded values for the time being).  If the LOGIN button is pressed on the screen and an invalid username or password is entered, a MessageDLG will appear, letting the user know. 

 

Right now, if OK is pressed on the window, the test ends.  I would like to capture the On Click event for the OK button on the MessageDLG to go back to the login page for the user to try again instead of ending the test.  I cannot however figure out the method to accomplish this. 

 

Does anyone have any suggestions?

  • NisHera's avatar
    NisHera
    Valued Contributor

    probably you may have put an error on wrong loging and set stop on error on TC project properties.

    try removing that . even thougt events are not nessasary in that situation, you can read this

     

    Onclick event captured by your app itself not TC.

    From TC you are clicking the Ok button , so you(TC) knows when it's being clicked. 

    • kcoffrin's avatar
      kcoffrin
      Contributor

      Thanks for the reply.  Since I am not a developer, any way you can provide a code example in JScript on how this might work in Test Complete?

      • NisHera's avatar
        NisHera
        Valued Contributor

        I have misunderstood your question.

        anyway will reply you with code later.. 

  • Hi

     

    1. Initially you have Login Page
    2. You Entered Wrong Credential
    3. Due to that wrong credential the Dialog Page appear with Ok button
    4. Now the click operation performed in OK button
    5. Test Stopped after click the OK button

     

    is this your question right?

     

    From my understanding your test should be continue after clicking the ok button

     

    You should validate the DLG box and login page are exist or not with IF condition After that you can proceed with correct credential

     

    Thanks

    Kamal

    • kcoffrin's avatar
      kcoffrin
      Contributor

      You are 100% correct.  That is exactly what I am trying to accomplish. 

       

      Thanks for the suggestion about the IF condition for the DLG and the form.   

       

      Followup:

       

      After the IF condition, what command do I use to bring the user back to the main login form?  

       

      As stated in your previous case, once the OK button is pressed on the DLG box, the test ends. 

       

      I have tried Userforms.MyformName.ShowModal() after the condition...but I receive an error :(. 

       

      Thanks

      • Kamal_chennai's avatar
        Kamal_chennai
        Contributor

        Can we get some additional info like images and HTML log files of your Tested Application

         

        Thanks,

        Kamal