Search code examples
javaswingsilktest

How to get the attribute value of a Java Swing application object in SilkTest?


Every Java Swing application has some attribute like caption, priorLabel, className, accessibleName and name. These are displayed in the Locator Spy; some with values and some without values.

My question is: The way we have GetDomAttribute() method available for web applications, do we have any such method available for Java Swing applications in SilkTest?

What if I want to get the aforementioned attribute values in a java swing application even if these attributes are not having any value (in such situation, I suppose, I will get an empty string).

Please suggest!


Solution

  • I think the closest match for GetDomAttribute() would be the dynamic property support in Silk Test:

    1. Use GetPropertyList() to get a list of properties available for a certain object.

    2. Use a property name from that list with GetProperty().

    3. If that is not sufficient, you can also use DynamicInvoke, which is documented here (also includes dynamic properties).