Testing a Flex Custom Control Using Dynamic Invoke

Silk4J provides record and playback support for custom controls using dynamic invoke to interact with the custom control during replay. Use this low-effort approach when you want to access properties and methods of the custom control in the test application that Silk4J does not expose. The developer of the custom control can also add methods and properties to the custom control specifically for making the control easier to test.

  1. To retrieve a list of supported dynamic methods for a control, use the getDynamicMethodList method.
  2. Call dynamic methods on objects with the invoke method.
  3. To retrieve a list of supported dynamic properties for a control, use the getPropertyList method.
  4. Retrieve dynamic properties with the getProperty method and set dynamic properties with the setProperty method.


The following example tests a spinner custom control that includes two buttons and a textfield, as shown in the following graphic.

Flex custom control

The user can click Down to decrement the value that is displayed in the textfield and click Up to increment the value in the textfield.

The custom control offers a public "Value" property that can be set and retrieved.

To set the spinner's value to 4, type the following:
FlexBox spinner = _desktop.<FlexBox>find("//FlexBox[@className=customcontrols.Spinner]");
spinner.setProperty("Value", 4);