Injects JavaScript code under the node matching the specified XPath.

This statement enables Convertigo to inject any JavaScript code in the target web page. It can then dynamically invoke any existing JavaScript code from the target page.
The Inject JS in browser statement dynamically creates a SCRIPT tag under the node designated by the XPath property, containing the JavaScript code specified by the JS code property, and executes it.

Property Type Category Description
Comment String standard Describes the object comment to include in the documentation report.
This property generally contains an explanation about the object.
Delay if XPath not found long standard Defines the maximum delay the statement waits if the XPath doesn’t currently exists.
When no node in the page DOM matches the XPath defined in XPath property, the statement waits for it to match up to this delay, set in milliseconds.
Convertigo tries to evaluate the specified XPath while receiving a web page or executing JavaScript in it. Once the XPath matches at least one node of the page, the statement continues its action.
Note: It is equivalent to defining a statement Wait synchronization with an XPath synchronizer before this statement, waiting for the same XPath.
Is active boolean standard Defines whether the statement is active.
JS code String standard Defines the JavaScript code to inject and invoke.
Any JavaScript expression that will be valid for the page currently accessed by the HTML connector. This script is dynamically added as a SCRIPT tag under the node specified by the XPath property and evaluated.
For calling a JavaScript function already defined in the page, do it using this syntax: functionToBeCalled();. You can also replace an existing JavaScript function by writing another JavaScript function with a similar name. This can be useful if a website features JavaScript functions unsupported by Convertigo’s Mozilla/Firefox HTML parser.
You can also pass Convertigo variables to your JavaScript code by using the Variables property.
Variables XMLVector standard Declares and initializes variables from Convertigo in injected JavaScript code.
This property allows passing transaction’s scope variables to the JavaScript code injected in the web page. These variables will be initialized with a value resulting from a JavaScript expression evaluated during the transaction execution (for example using transaction variables).
These variables must be of standard types (for example int, string, etc.), complex types are not supported (for example Array or DOM).
For each variable, three columns have to be set:

Variable: the variable name,
Comment: a comment to illustrate this variable,
JS Expression: the JavaScript expression to execute to give the variable value.

Note: A new variable can be added to the list using the blue keyboard icon. The variables defined in the list can be ordered using the arrow up and arrow down buttons, or deleted using the red cross icon.
XPath JS expression standard Defines the XPath expression of elements on which the statement applies.
Depending on the statement, the execution of this XPath on the web page DOM can result in a single Node or a NodeList.
Synchronization TriggerXMLizer expert Defines how to synchronize the statement.
A synchronizer states how and when accessed pages are considered fully loaded. Only then are data extracted and new pages re-detected.
There are several types of synchronizers, that are described hereafter:

Document completed: The synchronizer waits for a number of documents to be completed. Specify here how many “document completed” events Convertigo has to wait for before assuming that the page is complete. In many cases, when the target application uses HTTP META redirects or JavaScript redirects, the document is loaded several times. You can monitor
==== start parse ======
and
==== Parse end ==(XXXms )====================
traces in the Engine console (debug mode) to count the number of “document completed” events needed for the synchronizer. The Document completed synchronizer can be configured to also stop on alert messages that could pop up. Alert messages do not trigger a “document completed” event and are not detected by this synchronizer. To activate this option, check the Stop on alert checkbox.
XPath: The synchronizer waits until a specified XPath is found. Convertigo tries to evaluate the specified XPath while receiving a web page or executing JavaScript in it. Once the XPath matches at least one node of the page, the synchronizer returns.
Wait time: The synchronizer waits until a specified time is reached (in ms, set via the Timeout property).
Screen Class: The synchronizer waits for one of the selected screen classes to be detected. Several screen classes can be selected to be waited for. The synchronizer returns when one of them is reached.
Download started: The synchronizer waits for a download request. This is the perfect synchronizer to use before a Get attachment statement.
No wait: The synchronizer doesn’t wait and execution proceeds directly.

For all synchronizer types, the maximum waiting time is set using the Timeout property.