Locate the Browser Object in the Java Application
To locate the browser object in the Java application:
2. | To capture a JAVA application, click ![]() |
3. | Click Inject. The grey ball turns green if the capture is successful. |
4. | In the Components tab, select Highlight and Show class. |
5. | Click Load. All the layers are shown. |
6. | For any browser-embedded Java application you should be able to find a class with the word “browser” in the class name. |
7. | Select the relevant object. |
8. | In the Jscript tab, find the methods and fields of the object. |
If a component has a field x, you can:
Set the field value: component.InternalObj.x = 0;
Get the field value: var a = component.InternalObj.x;
To call a method, use the following syntax:
component.<method name>(<return type>, <parameter types separated by commas>, <true == the method is static, false otherwise>, <parameters if any>);
For example, getComponentAt returns the component located at coordinates (x,y):
var c = component.InternalObj.getComponentAt(“java.awt.Component”,”int,int”,false, 2, 1);
The last line in the script returns a result if any.
9. | Call getSelectedItem. |
10. | Use your JavaScript experience to look for a method such as getBrowser, or any method that has a similar name. The objective is to get the browser object so that you can call JavaScript functions on it. |
Sometimes, the object itself is the browser object, in which case you don’t need to look for getBrowser. You can simply execute the JS function directly on the object.