Lieutenant Commander
Lieutenant Commander
445 views

java.lang.RuntimeException: Cannot obtain keyboard focus.error when setFocus method used in Silk4J

Hi ,

  I am trying to run some Silk4j keyword driven tests from SilkCentral. I trigger the scripts in SilkCentral from my local machine and the scripts run on a remote machine. I get an error 'Cannot obtain keyboard focus' wherever I have used SetFocus method in my script. Please let me now how to fix it

Regards,

Raghavan.S

0 Likes
4 Replies
Micro Focus Expert
Micro Focus Expert

Hi @Raghavan_S 

Do the keyword driven tests execute without error directly from your Silk4J client?

If so, are there any environmental difference between your Execution Server machines and your Silk4J client machine? Do you access your Execution Server machines via RDP?

Regards
Robert

0 Likes
Lieutenant Commander
Lieutenant Commander

Hi Robert,

  Yes , it is working fine on my local machine and yes , we are trying to run the script on a remote desktop.

 

Regards,

Raghavan.S

0 Likes
Lieutenant Commander
Lieutenant Commander

Hi , the issue occurs when I trigger the script from silkcentral on my local machine and the actual script runs on a remote machine. Only the setFocus method fails. Please let me know if there are any solutions Regards, Raghavan.S
0 Likes
Micro Focus Expert
Micro Focus Expert

Hi @Raghavan_S 

I can only assume that if you use RDP, the RDP session has been minimized or closed forcing which causes the remote machine to enter GUI-less mode. This would prevent Silk4J from being able to assign keyboard focus to the control that you want to interact with.

Try connecting to the remote machine via RDP, then execute the test from Silk Central.

Do not minimize or close the RDP session while the test is running, does the error occur?

Regards
Robert

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.