I’m currently using the Visual Studio plugin of the Telerik Web Test tool (version 2012.2.1204.0) to run tests on a user-based website that spawns a scripted ‘onbeforeunload’ dialog box when navigating to another URL. As this website doesn’t have designated logout functionality, navigating to another URL is the only way to logout.
Handling this dialog box can be done by the ‘OnBeforeUnload’ functionality included in the test tool. This generally works fine, but I ran into some problems when running my tests on a remote desktop when the remote desktop connection is minimized.
I’m not a through-and-through experienced c# user so correct me if I’m wrong, but what I think I’ve seen in the OnBeforeUnload method (ArtOfTest.WebAii.Dialogs.OnBeforeUnloadDialog.cs) in combination with my experience with this tool, is that when the active (parent) browser doesn’t have user focus this method tries to restore this focus, after which it tries to invoke or simulate some user actions like ‘press escape’ or ‘enter’ using the user keyboard (via the desktop.KeyBoard.KeyPress method) in order to handle the dialog box.
This doesn’t work too well with a remote desktop though. When the remote desktop connection utility is minimized the keypress method cannot acces any of the user's input devises, and so the dialogbox isn't handled (and remains stuck/not-handled), thus making running my tests impossible.
My question is this:
How do I handle the ‘on before unload’ dialog box under these conditions? Is there any way to do it without invoking an input device?
- Something that (hopefully) makes it easier in this specific case to solve this issue is that I do not particularly care which option is selected in this dialog box, as long as it is either handled or forced to close.
Thanks in advance for your time and help.