unable to click a button when screen protected

Class library usage, coding and language questions.
Kevin
Posts: 6
Joined: Fri Nov 05, 2010 6:11 pm

unable to click a button when screen protected

Post by Kevin » Wed Nov 10, 2010 12:39 pm

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!

Kevin
Posts: 6
Joined: Fri Nov 05, 2010 6:11 pm

Re: unable to click a button when screen protected

Post by Kevin » Wed Nov 10, 2010 12:49 pm

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.

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: unable to click a button when screen protected

Post by Support Team » Wed Nov 10, 2010 1:17 pm

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
.
Image

Kevin
Posts: 6
Joined: Fri Nov 05, 2010 6:11 pm

Re: unable to click a button when screen protected

Post by Kevin » Wed Nov 10, 2010 2:52 pm

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}' ".
Attachments
Button_Press_Exception_2010-11-10 21-11-00.jpg
Button_Press_Exception_2010-11-10 21-11-00.jpg (60.42 KiB) Viewed 1291 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: unable to click a button when screen protected

Post by Support Team » Wed Nov 10, 2010 4:00 pm

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
.
Image

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: unable to click a button when screen protected

Post by Ciege » Wed Nov 10, 2010 4:01 pm

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.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

Kevin
Posts: 6
Joined: Fri Nov 05, 2010 6:11 pm

Re: unable to click a button when screen protected

Post by Kevin » Thu Nov 11, 2010 7:58 am

Hi Ciege, I'm using RDP. I perfer your solution one. I believe it can resolve my problem.

Thanks a lot !