How to work with unidentifiable objects in Java Application
Identifying objects in complex Java applications using Worksoft Certify
Dealing with the complex objects of any kind of application is a major challenge for automation. Worksoft Certify has the capability to overcome such challenges irrespective of the type of platform making our life easy as automation developer. Many of us are already aware of handling complex objects for Web and SAP applications. Let us now see how to handle complex Java objects.
In Certify a Window/Object of any application is recognized by its attribute/tag elements. Similarly, for identifying objects in Java applications through Certify we need to use various Tag elements in the object attributes such as Caption, Certify Class, Logical Name, By etc.
In case of complex Java applications, some of the objects may not be learned or identified using Certify. Unlike Extensibility Framework tool for Web applications (refer to: Demystifying Certify eXtensibility Framework), we do not have any alternate tool which can identify such complex Java objects. But, we still do have an alternative way of resolving such object identification issue for complex java applications by using the ‘By’ tag.
Consider the sample application provided by Worksoft with its installation package. In this application, there is a label called ‘Account Name’ and besides it there is a text box where we need to enter a value for the Account Name.
The field to enter the value of Account Name cannot be identified through Certify.
The non-identifiable object can be identified with reference to some identifiable object in the application. This can be achieved by using a ‘By’ tag in the attribute string.
Basically, we can handle this issue in a single attribute string. First, we need to identify the identifiable object and then move towards the non-identifiable field using ‘By Tag’. In general, the non-identifiable object can be of any type such as Textbox, Checkbox, Button etc. So, based on the type of object we need to use the corresponding Certify Class and Class.
The attribute of the non-identifiable Java object is created as below:
<object platform=”Java” findby=”test”><logicalname>Account Name:</logicalname><certifyclass>javaEdit</certifyclass><class>javax.swing.JTextField</class><by><object><caption match=”equals”>Account Name:</caption></object><right>1</right></by></object>
In general, the moves within a “by” element is an integer. It has these values <right>n</right>, <left>n</left>, <down>n</down>, and <up>n</up>
The moves are basically the directions that you need to move to locate the object that is not identifiable from the reference to the object that can be identified.
In this sample application the textbox Account Name is identifiable using Certify learn, but to illustrate the use of ‘By’ tag the above scenario was used considering the similar scenario in other real-time applications that you may encounter.
Regardless of the java application the above solution holds good for any similar issues that you may encounter in your application.
Contributed by Srabanti Pramanik