Disable mouse movement during test execution

Best practices, code snippets for common functionality, examples, and guidelines.
Ruser
Posts: 24
Joined: Wed Oct 07, 2009 3:26 pm

Disable mouse movement during test execution

Post by Ruser » Thu Jan 14, 2010 11:46 pm

Is there any way to diable real mouse movement during executing test? Or is this a feature we might have in the future?

During test execution, I have to ensure there is no pop up window other than the system under test. Otherwise, the mouse click might be wrong.

Also, if I use remote desktop control to execute a test, I can close the window after kicking off the test.

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Mouse movement during test execution

Post by Support Team » Fri Jan 15, 2010 1:19 pm

Ruser wrote:Is there any way to diable real mouse movement during executing test? Or is this a feature we might have in the future?
Yes, there is a way to disable mouse/keyboard input coming from the physical devices. To do that just set the Keyboard.Enabled and Mouse.Enabled properties to false. Be careful, though, if you disable both keyboard and mouse, because both devices will stay disabled until you set the Enabled property back to true or the automation process ends!
Ruser wrote:Also, if I use remote desktop control to execute a test, I can close the window after kicking off the test.
Please note, that you must not close the Remote Desktop window when you execute an automation via Remote Desktop! When you close the Remote Desktop window, Windows will lock the desktop on the remote machine making automation impossible (mouse and keyboard inputs are disabled completely). If you want to close the remote window, use a VNC system (like UltraVNC) instead of Remote Desktop!

Regards,
Alex
Ranorex Support Team

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: Mouse movement during test execution

Post by Gunner1980 » Thu Apr 08, 2010 4:22 am

Where do you use this mouse.enabled disabled at? Do you put this in your program.cs, in recording user code or is this a setting somewhere that you can set at compile time or in a properties page somewhere?
:?:

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Re: Mouse movement during test execution

Post by Support Team » Thu Apr 08, 2010 9:04 am

Hi!
Gunner1980 wrote:Where do you use this mouse.enabled disabled at?
If you want to disable the input for the whole test cycle, you should set the
Keyboard.Enabled = false;
and
Mouse.Enabled = false;
in the program.cs file. But be careful using the properties, because when you set both to false you cannot abort the test without an AbortKey. So also use
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
in program.cs (main mehtod) to abort the test if something unexpected happened for example an endless loop.
Gunner1980 wrote:in recording user code or is this a setting somewhere that you can set at compile time or in a properties page somewhere?
You also can use it for only one recording. In this case you enable/disable this dircetly in user code before you executing some actions. But don't forget to enable it on the end of your recording and use AbortKey.

Regards,
Peter
Ranorex Support Team

User avatar
Gunner1980
Posts: 89
Joined: Mon Apr 05, 2010 8:44 pm
Location: Austin, Texas

Re: Mouse movement during test execution

Post by Gunner1980 » Thu Apr 08, 2010 6:37 pm

Thank you worked like a charm!