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?
probably you may have put an error on wrong loging and set stop on error on TC project properties.
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.
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
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.
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 :(.