Recto jr Caramat
Recto jr Caramat

Reputation: 21

Java Robot Not working when PC is locked

I already have a program that uses robot class to do set of tasks. Everything is doing fine, however, I noticed that when my computer is locked, the robot is not working.

Do you know how to solve this issue? or is it possible to use robot even your computer is locked?

Upvotes: 2

Views: 2049

Answers (2)

Kaushik
Kaushik

Reputation: 99

This is the behavior of Robot class, that when machine is locked simulations will not be performed. The turnaround for this is to create a vbs script that has keypress event of pressing F13(shift+f1). If you are using testng then call this keyword in @beforesuite using Runtime.getruntime.exe(String[]{wscript.exe,"path of vbs"}). This will help your system to keep active till your execution is completed. In @aftersuite kill the process.

Upvotes: 0

Antoine
Antoine

Reputation: 880

If anyone searches this issue because they run selenium tests on a server (like me) and the PC has to be unlock for the tests to work.

No, it is not possible to use robot while the PC is locked.

However, you can use the robot library to login, and then run your tests normally. Note that you cannot use remote desktop while the tests are running, it would interfere with the robot.

Hope this helps.

Upvotes: 1

Related Questions