IBM Support

Forcing IBM Rational Robot object recognition by Object Name with Java Swing objects

Troubleshooting


Problem

Some types of Java Objects ( e.g., Java Swing related ) are recognized according to an index value rather than by their Object name. This can be a problem if the index values change with recompilations. Example: A Java Swing application consists of some push buttons ( JButton) and a JTextField (editbox). When you select the pushbutton Robot object recognition is based on the object name. However, when you select the JTextField - the Robot object recognition is based on the Index value. This is a problem for the customer because these indexes keep changing making it hard for them to update the scripts when ever the screen gets changes. The object names are unique. So we would want the robot to record the object names.

Cause

Robot by default uses "accessible name" rather than the "name" set on the particular object ( Object.setName() ).

Resolving The Problem

Forcing object recognition by Object Name is accomplished by the following technique:


Go into the Windows Registry. Navigate to the key directory named: HKEY_CURRENT_USER\Software\Rational Software\Rational Test\8\Robot.

Now add a new string value called: "JavaUseAnyProgrammaticName".
Set its value to the ( string ) value of 1. Now start robot and record.
This will remedy the problem for all new recordings (with no Java application changes).

In addition, or if preferred, another technique will also work that requires a modification to the Java application itself. For the JTextField object, the following line of could be added to make sure that the robot succeeds in using name based Object recognition.

JTextField jt = new JTextField();
jt.getAccessibleContext().setAccessibleName("Test");

Either of these approaches can be used to force name based Object Recognition.





[{"Product":{"code":"SSSHDX","label":"Rational Robot"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Recording","Platform":[{"code":"PF033","label":"Windows"}],"Version":"2002.05.00;2002 Release 2;2002.05.20;2003;2003.06.00;2003.06.12","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

More support for:
Rational Robot

Software version:
2002.05.00, 2002 Release 2, 2002.05.20, 2003, 2003.06.00, 2003.06.12

Operating system(s):
Windows

Document number:
578289

Modified date:
16 June 2018

UID

swg21166414