I was writing some tests and try to validate that some system messagebox is popping up. Like in http://www.dotnetperls.com/messagebox-show. However, the class MessageBox is for creating the messagebox. How shall I capture and validate an system generated one and operate on it?
eg: The actions are:
1.click on some execute file.
2.validate a warning messagebox pop up
3.click on yes/no on the messagebox
Any hint please?
One choice is to use White automation framework.
For example:
White Framework +1 !!
You can check my answer I posted for asserting a message box and use messageBox.Get() method to click Ok button.
Ref: https://stackoverflow.com/a/35219222/2902212
window.MessageBox() is a good solution
But this method would stuck for a long time if the messagebox doesn't appear. Sometimes I want to check "Not Appearance" of a messagebox (Warning, Error, etc.). So I write a method to set the timeOut by threading.