Do not Automate via Remote Desktop Window
The first important thing to know is that Ranorex, as every other automation software, is not able to automate via the Remote Desktop window. It is not possible to recognize any controls since the content of the remote desktop is only provided as one big image.
The only way to automate using the Remote Desktop window to work coordinate based or with image comparison. This is not recommended by Ranorex because minimal variances in your system will make your tests fail.
To guarantee successfully testing on remote machines, you have to install and start all Ranorex Tools you need on the remotely connected machine.
Do not Close or Minimize the RDP Window
Remote Desktop locks the screen when you minimize or close the Remote Desktop window. That causes screenshots to be blank/black and automation to fail. Consequently, if you use Remote Desktop, you need to have the RDP window open during automation and not closed or minimized.
Also make sure that the screensaver is not activated on your remotely connected machine as the screensaver will also lock the Remote Desktop's screen.
As a workaround, you can set up one machine having all of your Remote Desktop windows opened. This machine does not do any automation. And while your tests are running on the different Remote Desktops – with the client windows opened on the mentioned machine – you can lock the desktop on this machine. While your client desktop is locked, the Remote Desktop sessions will remain opened and your test will continue.
An alternative to RDP is using VNC or the VMWare Remote Console as these tools will not lock the screen when closing or minimizing the remote client window.
Disable Mouse/Keyboard Activities
As an alternative to locking the screen on your Remote Desktop, you can disable the physical mouse and keyboard on the remote machine. To do that just set the Ranorex Keyboard.Enabled and Mouse.Enabled properties to false. Be careful 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!
If you want to disable the input for the whole test cycle, you should set
Keyboard.Enabled = false;
Mouse.Enabled = false;
in the Program.cs file.
But again be careful when using these properties because when you set both to false you cannot abort the test without an AbortKey set.
So also set
Keyboard.AbortKey = System.Windows.Forms.Keys.Pause;
in Program.cs to abort the test if something unexpected (e.g. an endless loop) happens.
You can also use this technique for one recording only. In this case you have to enable/disable the mouse and keyboard controls in user code directly before executing specific actions. As always, don't forget to enable controls again at the end of your recording and to set an AbortKey.
Use same Color and Resolution Settings
If you perform image based automation/validation on remote machines, you have to make sure that color and resolution settings are the same as on the machine you made the test/recording on.
Please also make sure that you have activated the same windows scheme since your application under test might be displayed differently when having different schemes activated.
Increase Timeouts on Virtual MachinesThings might run a little slower on a virtual machine compared to real machine because multiple virtual machines may share the same physical host. Consequently it can take more time on a Virtual Machine to find some elements. You may need to increase repository timeouts for specific elements or alter your tests to check for ready states on your application under test. It's recommended to use the global timeout factor to adapt the timeouts for a specific test run.
Keeping remote session unlocked even if closing it
There is a way to keep the remote session unlocked even if you've disconnected the RDP session.
Find out more here: Ranorex Remote FAQ
- Ranorex Studio - The Layout
- Lesson 1: Getting Started
- Lesson 2: Ranorex Modules - Test Actions
- Lesson 3: Data-Driven Testing
- Lesson 4: Ranorex Test Suite
- Lesson 5: Ranorex Recorder
- Lesson 6: UI Mapping with Ranorex Repository
- Lesson 7: Code Modules
- Lesson 8: Reporting
- Lesson 9: Ranorex Spy
- Ranorex Settings
- Ranorex Remote
- User Code Library
- Selenium WebDriver integration
- Code Examples
- Data Connectors
- Instrumentation Wizard
- Technology Instrumentation
- RanoreXPath Weight Rule Library
- Ranorex UI Adapter
- Mobile Testing
- Android Testing
- iOS Testing
- Web Testing
- Source Control
- Ranorex Studio IDE
- Visual Studio Integration
- System Requirements
- 64-bit Platforms
- Remotely Working with Ranorex
- Silent Installation of Ranorex
- XCOPY Deployment
- How to instructions