This functionality is supported only if you are using the Classic Agent.
Non-graphical custom controls are controls which are not owner drawn. If your application uses a non-graphical control that does not map to any of the controls that are supported by
Silk Test Classic, you have the following options:
- If the developer of the application has created DLLs to interact with the custom object, you can call the DLL functions from a script.
- Otherwise, and only if you are working with the Classic Agent, you can add partial support for the non-graphical custom object by creating a new class, derived from
AnyWin. Then, to implement the methods for the non-graphical control, you can write methods that use the primitive methods of the
AnyWin class, like
TypeKeys and
MoveMouse. You have to manually change the scripts for your application, because the custom methods cannot be recorded.
Example
In the following sample code, the class
MyCustomTextField, which is a custom control in the application
myApplication, is derived from the
AnyWin class. The method
TypeText is added to
MyCustomTextField, and performs a
Click and a
TypeKeys.
const wDynamicMainWindow = MyApplication
window MainWin MyApplication
locator "/MainWin[@caption=My Application']"
// The working directory of the application when it is invoked
const sDir = "%USERPROFILE%"
// The command line used to invoke the application
const sCmdLine = "C:\myApplication.exe"
MyCustomTextField TextField
tag "TextField"
winclass MyCustomTextField : AnyWin
void TypeText(string text)
Click(1, 0)
TypeKeys(text)
The test case
Test1 calls the
TypeText method.
testcase Test1 ()
recording
MyApplication.SetActive()
MyApplication.TextField.TypeText("test")