Page 1 of 1

unable to click a button when screen protected

Posted: Wed Nov 10, 2010 12:39 pm
by Kevin
I use Ranorex API to click a button on my application. My application is made by .NET 2.0, running on a remote server and I want it to be running repeatedly in an unattended mode.

Firstly, I use button.MoveTo(), and button.Click(). It works well when I'm watching it. But if I switch to my computer, and after several minutes, get back to this server, I find the click() can't work.

I think the Click() function can't work in an attended mode. So I use button.Press() to replace MoveTo and Click. This time the button did work (because i can see the result) however I also get an exception saying "button press fail". I'm confused...

Any clarification for this issue is highly appreciated!

Re: unable to click a button when screen protected

Posted: Wed Nov 10, 2010 12:49 pm
by Kevin
Or, in other word, is there any method like "PerformClick" for a form button?
As I know, PerformClick() is used to click a button without mouse.

Re: unable to click a button when screen protected

Posted: Wed Nov 10, 2010 1:17 pm
by Support Team
Hi,

You are using the right method (Press()) to perform a click on the button without using the mouse,
I've created a .Net 2.0 Windows Forms Application with a button inside and used the Press() method of Ranorex to click this button without mouse. This was working as expected. Would it be possible to send us a Ranorex Snapshot of your whole application? And please let me know if the control you are using, is a third party control.
Create a Ranorex Snapshot

Regards,
Peter
Ranorex Team

Re: unable to click a button when screen protected

Posted: Wed Nov 10, 2010 2:52 pm
by Kevin
Thanks a lot for your relpy. I don't have a Ranorex snapshot however I can show you the form on which the "Process" button is expected to be pressed. (see attachment)

When the button is pressed, a new form will be present. Then the exception will be thrown "Action 'press' failed on element '{Button:&Process}' ".

Re: unable to click a button when screen protected

Posted: Wed Nov 10, 2010 4:00 pm
by Support Team
Hi,

I received following mail from you:
"I think I can catch and ignore the button.press() exception for now because it doesn’t affect my program".

If you have any other questions, don't hesitate to contact us.

Regards,
Peter
Ranorex Team

Re: unable to click a button when screen protected

Posted: Wed Nov 10, 2010 4:01 pm
by Ciege
What methodology are you using to connect to your remote server? RDP or similar?
If using RDP, when you leave the session the screen becomes locked (as you put it your title, screen protected), therefore the GUI doesn't really exist anymore and Ranorex (or any automation utility) cannot interact with the nonexistent GUI anymore. Then your tests begin to fail...

You need to try one of a few different solutions:
1) Using RDP - make sure you keep a window or a connection open to the RDP session at all times. You can minimize it on your local desktop, but keep the session open. With keeping the session open the console will remain and your tests will continue.
2) I've not used it both others have claimed success - Use something like VNC that does not close the console down when you disconnect from the session.

Re: unable to click a button when screen protected

Posted: Thu Nov 11, 2010 7:58 am
by Kevin
Hi Ciege, I'm using RDP. I perfer your solution one. I believe it can resolve my problem.

Thanks a lot !