Mouse Click doesn't work when the VM isn't on the foreground

Best practices, code snippets for common functionality, examples, and guidelines.
pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Mon May 20, 2019 9:55 am

Hello everyone !

The problem is exactly what the title is ^^

I have installed Ranorex 9.0.1 (last version when I post this) on a VM Windows Server 2018. My tests work correctly as long as I have the VM on the foreground. When I run the test and reduce the VM (going back to the physical machine), the clicks doesn't work, and there are some actions where I can't replace them by PerformClick. The test simply pass over it, like if there was no click command in the test.

Did this already happened to someone please ?

Thanks in advance !
Last edited by pgirardin on Tue May 21, 2019 4:42 pm, edited 1 time in total.

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by odklizec » Mon May 20, 2019 12:49 pm

Hi,

Are you using remote desktop to connect to the VM? And do I understand it right, that you are minimizing the RDP window? If RDP window is minimized, RDP disconnects from target computer. To avoid this, you must either keep the RDP window maximized or apply an RDP hack to keep the RDP session alive. For more details about running tests in RDP environment, please check this FAQ post:
https://www.ranorex.com/help/latest/ran ... lRDPbrspan
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Mon May 20, 2019 1:26 pm

Hello odklizec,

Thanks for your reply.

Yes I am using Remote Desktop to connect to the VM.
Yes I am minimizing the RDP window, sorry I translated it badly from french ^^"

I also have the same problem when using Jenkins. It runs the tests on another VM that I shouldn't have to connect to, and the click don't work. From what I read on the link you gave me, it is mandatory to let the RDP maximized, which is very problematic for me.

Is the .bat solution the only one ?

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by odklizec » Mon May 20, 2019 1:34 pm

Hi,

There are some other solutions to the RDP minimalization problem. You could try for example registry hack, described here:
https://docs.telerik.com/teststudio/kno ... imized-rdc

As for Jenkins, I would suggest to use LogonExpert tool, which keeps the session logged:
https://www.logonexpert.com/

For more details and suggestions, check this discussion:
https://www.ranorex.com/forum/problems- ... 13094.html
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Mon May 20, 2019 4:27 pm

Hello,

I tried all the solutions, but the problem subsists without showing any new info...

pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Tue May 21, 2019 11:30 am

So, am I the only one with this problem ? :'(

User avatar
odklizec
Ranorex Guru
Ranorex Guru
Posts: 7470
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by odklizec » Tue May 21, 2019 11:36 am

Hi,

Unfortunately, without seeing your test workflow and Jenkins setup, there is not much anyone here can do or suggest. I'm using RDP and Jenkins on a daily basis and everything works as expected. So my best guess is, that there is something wrong with your setup?

As mentioned before, Ranorex requires realized desktop. So if you are using RDP, the RDP window must either stay maximized, or you must apply one of the available hacks to keep the connection alive, even after minimizing/closing RDP window.
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Tue May 21, 2019 2:37 pm

Hi again,

Indeed, there must be something wrong with my setup... Do you have any idea of what could cause this kind of error ?

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by McTurtle » Wed May 22, 2019 1:54 pm

Hello pgirardin,

As odklizec said... There is nothing wrong with your setup, you simply have to implement one of the multiple hacks. Test automation is not possible when there is no GUI. This is a limitation of test automation. There is no GUI when you minimize the RDP session because Windows hides the whole user interface.

I always liked this approach the most: Batch file

Simply create the batch file and then instead of minimizing the RDP window, right click on the batch file and choose "Run as administrator".

Does this help?

Regards,
McTurtle

pgirardin
Posts: 8
Joined: Mon May 20, 2019 9:35 am

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by pgirardin » Wed May 22, 2019 2:06 pm

Hello McTurtle,

Thank you for your answer, now it works ! I simply forgot to run as administrator... :roll:

And same thanks to odklizec who also proposed the correct answer.

McTurtle
Posts: 297
Joined: Thu Feb 23, 2017 10:37 am
Location: Benedikt, Slovenia

Re: Mouse Click doesn't work when the VM isn't on the foreground

Post by McTurtle » Wed May 22, 2019 2:08 pm

Hi pgirardin,

The devil is in the details ;)

Regards,
McTurtle