Agent Options

This section describes the options that can be manipulated with the GetOption and SetOption methods.

Note: By default, you can set global options by choosing Silk4NET > Edit Options in the menu.

To set or get agent options in a script, use the GetOption or SetOption methods. For instance, when you type, Agent.SetOption(Options., the agent options display automatically in the active editor window with the auto-completion and syntactical assistance technology. For instance, you might see the following options in the active editor window:

Code window syntax

An example for inserting an option into a script would be the following:
'VB .NET code
Agent.SetOption(Options.ApplicationReadyTimeout, 100000)
// C# code
Agent.SetOption(Options.ApplicationReadyTimeout, 100000);
Alternatively, you can use the agent option name in scripts. For instance, you can type:
'VB .NET code
Agent.SetOption("OPT_APPREADY_TIMEOUT", 100000)
// C# code
Agent.SetOption("OPT_APPREADY_TIMEOUT", 100000);
.NET Option Name Agent Option Name Constant Type Description
ApplicationReadyTimeout OPT_APPREADY_TIMEOUT NUMBER Specifies the number of milliseconds to wait for a newly launched application to become ready. If the application is not ready within the specified timeout, Silk4NET raises an exception.
BitmapMatchCount OPT_BITMAP_MATCH_COUNT INTEGER Specifies the number of consecutive snapshots that must be the same for the bitmap to be considered stable. Snapshots are taken up to the number of seconds specified by OPT_BITMAP_MATCH_TIMEOUT, with a pause specified by OPT_BITMAP_MATCH_INTERVAL occurring between each snapshot.

By default, this is 0.

BitmapMatchInterval OPT_BITMAP_MATCH_INTERVAL REAL Specifies the time interval between snapshots to use for ensuring the stability of the bitmap image. The snapshots are taken up to the time specified by OPT_BITMAP_MATCH_TIMEOUT.

By default, this is 0.1.

BitmapMatchTimeout OPT_BITMAP_MATCH_TIMEOUT REAL Specifies the total time allowed for a bitmap image to become stable.

During the time period, Silk4NET takes multiple snapshots of the image, waiting the number of seconds specified with OPT_BITMAP_MATCH_TIMEOUT between snapshots. If the value returned by OPT_BITMAP_MATCH_TIMEOUT is reached before the number of bitmaps specified by OPT_BITMAP_MATCH_COUNT match, Silk4NET stops taking snapshots and raises the exception E_BITMAP_NOT_STABLE.

By default, this is 5.

BitmapPixelTolerance OPT_BITMAP_PIXEL_TOLERANCE INTEGER Specifies the number of pixels of difference below which two bitmaps are considered to match. If the number of pixels that are different is smaller than the number specified with this option, the bitmaps are considered identical. The maximum tolerance is 32767 pixels.

By default, this is 0.

ButttonsToCloseWindows OPT_CLOSE_WINDOW_BUTTONS LIST OF STRING Specifies the buttons used to close windows with the CloseSynchron method.
ButttonsToConfirmDialogs OPT_CLOSE_CONFIRM_BUTTONS LIST OF STRING Specifies the buttons used to close confirmation dialog boxes that appear when closing windows with the CloseSynchron method.
CloseUnresponsiveApplications OPT_KILL_HANGING_APPS BOOLEAN Specifies whether unresponsive applications are closed. An application is unresponsive if communication between the Agent and the application fails, e.g. times out. Set this option to TRUE when testing applications that cannot run multiple instances. By default, this is FALSE.
CloseWindowTimeout OPT_CLOSE_WINDOW_TIMEOUT NUMBER Specifies the number of milliseconds to wait before the next close strategy is tried. The Agent executes four close attempts before failing, so the total time before a close fails is four times the value you specify.
Compatibility OPT_COMPATIBILITY STRING

Enables you to use the Silk4NET behavior of the specified Silk4NET version for specific features, when the behavior of these features has changed in the latest version.

Example strings:
  • 12
  • 11.1
  • 13.0.1

By default, this option is not set.

EnsureObjectIsActive OPT_ENSURE_ACTIVE_OBJDEF BOOLEAN Ensures that the target object is active. By default, this is FALSE.
EnableAccessibility OPT_ENABLE_ACCESSIBILITY BOOLEAN

TRUE to enable Accessibility when you are testing a Win32 application and Silk4NET cannot recognize objects. Accessibility is designed to enhance object recognition at the class level.

FALSE to disable Accessibility.

By default, this is FALSE.

Note: For Mozilla Firefox and Google Chrome, Accessibility is always activated and cannot be deactivated.
EnableMobileWebviewFallbackSupport OPT_ENABLE_MOBILE_WEBVIEW_FALLBACK_SUPPORT BOOLEAN

Enables mobile native fallback support for hybrid mobile applications that are not testable with the default browser support.

By default, this is FALSE.

EnableUiAutomationSupport OPT_ENABLE_UI_AUTOMATION_SUPPORT NUMBER

TRUE to enable Microsoft UI Automation support instead of the normal Win32 control recognition. This option might be useful when you are testing a Win32 application and Silk4NET cannot recognize objects. AUTODETECT to automatically enable Microsoft UI Automation support for JavaFX.

By default, this is FALSE.

HangAppTimeOut OPT_HANG_APP_TIME_OUT NUMBER

Specifies the Unresponsive application timeout, which is the timeout for pending playback actions.

The default value is 5000 milliseconds.

HighlightObjectDuringPlayback OPT_REPLAY_HIGHLIGHT BOOLEAN Specifies whether the current object is highlighted during playback.

By default, this is FALSE, which means that objects are not highlighted by default.

KeyboardEventDelay OPT_KEYBOARD_INPUT_DELAY NUMBER Sets the delay in milliseconds between playback of keyboard strokes.

Be aware that the optimal number you select can vary, depending on the application that you are testing. For example, if you are testing a Web application, a setting of 1 millisecond radically slows down the browser. However, setting this to 0 (zero) may cause basic application testing to fail.

KeysToCloseDialogs OPT_CLOSE_DIALOG_KEYS LIST OF STRING Specifies the keystroke sequence to close dialog boxes that open after trying to close a window with the CloseSynchron method. Examples include: <ESC>, <Alt+F4>.
LocatorAttributesCaseSensitive OPT_LOCATOR_ATTRIBUTES_CASE_SENSITIVE BOOLEAN

Set to Yes to add case-sensitivity to locator attribute names, or to No to match the locator names case insensitive. The names of locator attributes for mobile Web applications are always case insensitive, and this option is ignored when recording or replaying mobile Web applications.

MenuItemsToCloseWindows OPT_CLOSE_WINDOW_MENUS LIST OF STRING Specifies the menu items used to close windows with the CloseSynchron method. Examples include: "File/Exit*", "File/Quit*".
MouseEventDelay OPT_MOUSE_INPUT_DELAY NUMBER Specifies the delay in milliseconds used before each mouse event.
ObjectResolveRetryInterval OPT_WAIT_RESOLVE_OBJDEF_RETRY NUMBER Specifies the time in milliseconds to wait before re-trying to find an object that could not be immediately resolved during playback. When the ObjectResolveTimeout runs out, no further retries are attempted.
ObjectResolveTimeout OPT_WAIT_RESOLVE_OBJDEF NUMBER Specifies the time in milliseconds to wait for an object to be resolved during playback. As soon as the object is resolved, Silk4NET can recognize it.
PlaybackMode OPT_REPLAY_MODE NUMBER Defines how controls are replayed. Use low level to replay each control using the mouse and keyboard. Use high level to use the API to replay each control. All controls have a default playback mode assigned. When the default replay mode is selected, each control uses its default playback mode. The default mode delivers the most reliable results. Selecting low or high level playback overrides the playback mode of all controls with the playback mode selected.

Possible values include 0, 1 and 2. 0 is default, 1 is high level, 2 is low level. By default, this is 0.

PostReplayDelay OPT_POST_REPLAY_DELAY NUMBER Specifies the time in milliseconds to wait after invoking a function or setting a property.
RemoveFocusOnCaptureText OPT_REMOVE_FOCUS_ON_CAPTURE_TEXT BOOLEAN
Set to Yes to take the focus off the application under test during a text capture. By default, this is set to No, leaving the focus on the application under test. A text capture is performed during recording and replay by the following methods:
  • TextClick
  • TextCapture
  • TextExists
  • TextRect
SuspensionTimeout OPT_NTF_SUSPENSION_TIMEOUT NUMBER Specifies the maximum time in milliseconds to wait for an answer from the NTF. If the time is exceeded, the communication between NTF and the Open Agent is considered as suspended.
SyncTimeout OPT_SYNC_TIMEOUT NUMBER Specifies the maximum time in milliseconds for an object to be ready.
Note: When you upgrade from a Silk Test version prior to Silk Test 13.0, and you had set the OPT_XBROWSER_SYNC_TIMEOUT option, the Options dialog box will display the default value of the OPT_SYNC_TIMEOUT, although your timeout is still set to the value you have defined.
TransparentClasses OPT_TRANSPARENT_CLASSES LIST OF STRING
To simplify the object hierarchy and to shorten the length of the lines of code in your test scripts and functions, you can suppress the controls for certain unnecessary classes in the following technologies:
  • Win32.
  • Java AWT/Swing.
  • Java SWT/Eclipse.
  • Windows Presentation Foundation (WPF).
Specify the names of any classes that you want to ignore during recording and playback.
OPT_WPF_CHECK_DISPATCHER_FOR_IDLE BOOLEAN For some WPF applications the Silk Test synchronization might not work due to how certain controls are implemented, resulting in Silk4NET not recognising when the WPF application is idle. Setting this option to FALSE disables the WPF synchronization and prevents Silk4NET from checking the WPF dispatcher, which is the thread that controls the WPF application. Set this option to FALSE to solve synchronization issues with certain WPF applications. By default, this is TRUE.
WPFCustomClasses OPT_WPF_CUSTOM_CLASSES LIST OF STRING Specify the names of any WPF classes that you want to expose during recording and playback. For example, if a custom class called MyGrid derives from the WPF Grid class, the objects of the MyGrid custom class are not available for recording and playback. Grid objects are not available for recording and playback because the Grid class is not relevant for functional testing since it exists only for layout purposes. As a result, Grid objects are not exposed by default. In order to use custom classes that are based on classes that are not relevant to functional testing, add the custom class, in this case MyGrid, to the OPT_WPF_CUSTOM_CLASSES option. Then you can record, playback, find, verify properties, and perform any other supported actions for the specified classes.
WPFPrefillItems OPT_WPF_PREFILL_ITEMS BOOLEAN Defines whether items in a WPFItemsControl, like WPFComboBox or WPFListBox, are pre-filled during recording and playback. WPF itself lazily loads items for certain controls, so these items are not available for Silk4NET if they are not scrolled into view. Turn pre-filling on, which is the default setting, to additionally access items that are not accessible without scrolling them into view. However, some applications have problems when the items are pre-filled by Silk4NET in the background, and these applications can therefore crash. In this case turn pre-filling off.
XbrowserEnableIframeSupport OPT_XBROWSER_ENABLE_IFRAME_SUPPORT BOOLEAN

Specifies whether to enable iframe and frame support for browsers. If you are not interested in the content of the iframes in a web application, disabling the iframe support might improve replay performance. For example, disabling the iframe support might significantly improve replay performance for web pages with many adds and when testing in a mobile browser. This option is ignored by Internet Explorer. This option is enabled by default.

XBrowserExcludeIFrames OPT_XBROWSER_EXCLUDE_IFRAMES STRING Every entry in the list defines an attribute name and the corresponding value. All iframes and frames that do not match at least one of the entries are considered during testing. Wildcards are allowed, for example the entry "src:*advertising*" would exclude <IFRAME src=http://my.domain/advertising-banner.html>. This option is ignored by Internet Explorer. If the list is empty, all iframes and frames are considered during testing. Separate multiple entries with a comma.
XBrowserFindHiddenInputFields OPT_XBROWSER_FIND_HIDDEN_INPUT_FIELDS BOOLEAN

Specifies whether to display hidden input fields, which are HTML fields for which the tag includes type="hidden". The default value is TRUE.

XBrowserIncludeIFrames OPT_XBROWSER_INCLUDE_IFRAMES STRING Every entry in the list defines an attribute name and the corresponding value. All iframes and frames that do not match at least one of the entries are excluded. Wildcards are allowed, for example the entry "name:*form" would include <IFRAME name="user-form" src=…>. This option is ignored by Internet Explorer. If the list is empty, all iframes and frames are considered during testing. Separate multiple entries with a comma.
XBrowserSynchronizationMode OPT_XBROWSER_SYNC_MODE STRING Configures the supported synchronization mode for HTML or AJAX. Using the HTML mode ensures that all HTML documents are in an interactive state. With this mode, you can test simple Web pages. If more complex scenarios with Java script are used, it might be necessary to manually script synchronization functions, such as WaitForObject, WaitForProperty, WaitForDisappearance, or WaitForChildDisappearance. Using the AJAX mode eliminates the need to manually script synchronization functions. By default, this value is set to AJAX.
XBrowserSynchronizationTimeout OPT_XBROWSER_SYNC_TIMEOUT NUMBER Specifies the maximum time in milliseconds for an object to be ready.
Note: Deprecated. Use the option OPT_SYNC_TIMEOUT instead.
XBrowserSynchronizationURLExcludes OPT_XBROWSER_SYNC_EXCLUDE_URLS STRING Specifies the URL for the service or Web page that you want to exclude during page synchronization. Some AJAX frameworks or browser applications use special HTTP requests, which are permanently open in order to retrieve asynchronous data from the server. These requests may let the synchronization hang until the specified synchronization timeout expires. To prevent this situation, either use the HTML synchronization mode or specify the URL of the problematic request in the Synchronization exclude list setting.

Type the entire URL or a fragment of the URL, such as http://test.com/timeService or timeService.

Separate entries by comma, for example:
'VB .NET code
Agent.SetOption(OPT_XBROWSER_SYNC_EXCLUDE_URLS, { "fpdownload.macromedia.com", "fpdownload.adobe.com", "download.microsoft.com" })
// C# code
Agent.SetOption(OPT_XBROWSER_SYNC_EXCLUDE_URLS, { "fpdownload.macromedia.com", "fpdownload.adobe.com", "download.microsoft.com" });