Web Connector 25.2
Web Connector Help

# Choose How Long to Wait for Scripts

The Web Connector allows time for scripts to complete before processing a page. However, some web pages run scripts that never finish. For example, a page might contain a script that performs an AJAX request and then schedules itself to run again five seconds later. During the five-second interval between the script completing and running again, the script is inactive. The connector can determine that scripts are inactive, but it is impossible for the connector to determine whether the page has completely loaded or whether the script might add more content.

When the Web Connector detects that scripts have been inactive for a certain period of time, by default half a second, it considers a page to have finished loading. You can configure the duration of inactivity required by setting the parameter `ScriptActivityTimeout`. For example, if you set `ScriptActivityTimeout=1s`, all scripts must be inactive for a second before the connector processes the page.

NOTE: OpenText recommends setting a short duration for this parameter, because the connector must wait for at least the specified amount of time for every page that contains scripts. Increasing the duration of `ScriptInactivityTimeout` could significantly increase the amount of time required to complete a synchronize cycle.

If scripts do not become inactive or remain inactive for long enough, the connector eventually terminates the scripts. You can configure the maximum amount of time to wait for scripts by setting the configuration parameter `MaxWaitForScripts`. For example, to wait no longer than 10 seconds, set `MaxWaitForScripts=10s`. This time limit does not affect custom scripts specified by the `CustomJSScriptPath` configuration parameter.

As described above, some web pages run scripts that never finish, so by default the Web Connector does not consider having to terminate scripts as an error. The connector continues to process the page as if the scripts had completed successfully. In some cases, scripts are used to generate content and add links, so terminating a script could result in content being unreachable. You can therefore configure the connector to report an error and attempt to process the page again on the next synchronize cycle. To do this, set the configuration parameter `FailOnScriptTimeout=TRUE`.

## Wait For Page Elements to Load

You can configure the connector to wait until a web page matches a certain condition (such as the presence or absence of an element) before processing the page. For example, if a page displays a "loading" icon, you could wait for that to be removed from the page before processing the content.

To configure this, set the parameter WaitForStateSections and use the parameters described in Wait For State Parameters. To see the conditions that you can check for, see the parameter WaitForStateValidator.

NOTE: If you configure one or more WaitForStateSections in your configuration file, the following parameters are ignored and the connector uses your specified configuration(s) instead.

- ScriptInactivityTimeout
- MaxWaitForScripts
- FailOnScriptTimeout

Copyright 2025 Open Text
Version 25.2 | Last updated April 2025

Send documentation feedback

Close

Send documentation feedback

To send feedback using your default email client, open an email window.

Otherwise, send your feedback and the information below to MFI-swpdl.idoldocsfeedback@opentext.com.

We appreciate your feedback!

Product: Knowledge Discovery Web Connector 25.2

Topic Title: Choose How Long to Wait for Scripts