Synchronization is performed automatically before and after every method call. A method call is not started and does not end until the synchronization criteria is met.
Silk Test Workbench includes synchronization modes for HTML and AJAX.
The AJAX mode synchronization waits for the browser to be in a kind of idle state, which is especially useful for AJAX applications or pages that contain AJAX components. Using the AJAX mode eliminates the need to manually script synchronization functions (such as wait for objects to appear or disappear, wait for a specific property value, and so on), which eases the script creation process dramatically. This automatic synchronization is also the base for a successful record and playback approach without manual script adoptions.
Because of the true asynchronous nature of AJAX, generally there is no real idle state of the browser. Therefore, in rare situations, Silk Test Workbench will not recognize an end of the invoked method call and throws a timeout error after the specified timeout period. In these situations, it is necessary to set the synchronization mode to HTML at least for the problematic call.
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.
To add the URL to the exclusion filter, specify the URL in the Synchronization exclude list in the Options dialog box.
Use a monitoring tool to determine if playback errors occur because of a synchronization issue. For instance, you can use FindBugs, http://findbugs.sourceforge.net/, to determine if an AJAX call is affecting playback. Then, add the problematic service to the Synchronization exclude list.
You can configure page synchronization settings for each individual visual test or script or you can set global options that apply to all visual tests and scripts in the Options dialog box. Choose expand Playback and click xBrowser to configure these options.
To configure individual settings for visual tests, record the visual test and then insert a Playback setting step to override the global playback value. Settings include: Synchronization exclude list, Synchronization mode, and Synchronization timeout.
For example, for visual tests, you might set the Synchronization mode playback setting to HTML and then return the Synchronization mode to AJAX for the remaining steps if necessary.
Agent.SetOption(Options.XBrowserSynchronizationMode, mode)
For the mode, type 1 to use HTML and 2 to use AJAX.
Agent.SetOption(Options.XBrowserSynchronizationExcludes, URL)
Specify the URL or a fragment of the URL for any service or Web page that you want to exclude. For example, you might type http://example.com/syncsample/timeService.
Agent.SetOption(Options.XBrowserSynchronizationTimeout, time)
Specify the time in milliseconds.