Japanese character support for typeKey() method in robot model

Gururaj, Abhijith Abhijith_Gururaj at mentor.com
Sun Jun 2 18:19:56 UTC 2019


Hi,
We have a use case where we need to enter Japanese characters in certain input fields. Our automation framework uses Jemmy to test this functionality. It looks like this is not possible in Jemmy using the Robot dispatch model as we are getting the following error when we use the typeKey() method to set the text. There is a similar issue raised in this thread<https://netbeans.org/bugzilla/show_bug.cgi?id=21011>.

org.netbeans.jemmy.JemmyException: Exception during java.awt.Robot accessing
        at org.netbeans.jemmy.drivers.input.RobotDriver.makeAnOperation(RobotDriver.java:232)
        at org.netbeans.jemmy.drivers.input.RobotDriver.pressKey(RobotDriver.java:201)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.pressKey(KeyRobotDriver.java:94)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.pushKey(KeyRobotDriver.java:78)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.typeKey(KeyRobotDriver.java:84)
        at org.netbeans.jemmy.drivers.text.TextKeyboardDriver.typeText(TextKeyboardDriver.java:108)
        at org.netbeans.jemmy.operators.JTextComponentOperator$4.launch(JTextComponentOperator.java:532)
        at org.netbeans.jemmy.ActionProducer.launchAction(ActionProducer.java:337)
        at org.netbeans.jemmy.ActionProducer.run(ActionProducer.java:296)
Inner exception:
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.netbeans.jemmy.ClassReference.invokeMethod(ClassReference.java:159)
        at org.netbeans.jemmy.drivers.input.RobotDriver.makeAnOperation(RobotDriver.java:229)
        at org.netbeans.jemmy.drivers.input.RobotDriver.pressKey(RobotDriver.java:201)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.pressKey(KeyRobotDriver.java:94)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.pushKey(KeyRobotDriver.java:78)
        at org.netbeans.jemmy.drivers.input.KeyRobotDriver.typeKey(KeyRobotDriver.java:84)
        at org.netbeans.jemmy.drivers.text.TextKeyboardDriver.typeText(TextKeyboardDriver.java:108)
        at org.netbeans.jemmy.operators.JTextComponentOperator$4.launch(JTextComponentOperator.java:532)
        at org.netbeans.jemmy.ActionProducer.launchAction(ActionProducer.java:337)
        at org.netbeans.jemmy.ActionProducer.run(ActionProducer.java:296)
Caused by: java.lang.IllegalArgumentException: Invalid key code
        at java.awt.Robot.checkKeycodeArgument(Unknown Source)
        at java.awt.Robot.keyPress(Unknown Source)
        ... 14 more


Is there a support for multi-byte characters(CJK etc) in Jemmy's robot model? The only workaround we found for this was to change the dispatch model to  QUEUE_MODEL_MASK. We would still like to use the robot model for this purpose.

I would really appreciate a little help on this. Thanks!

Regards,
Abhijith



More information about the jemmy-dev mailing list