Synthetic Classic has reached end of support and is no longer available. Existing Synthetic Classic customers have been upgraded to the all-in-one Dynatrace software intelligence platform.

Executing JavaScript within a target window

The Custom action enables you to interact with a specified target window using your JavaScript instead of one of the predefined actions. The custom JavaScript can access and modify the DOM for the target window or frame.

When can you use this scripting method?

Only use this scripting method if the outcome you want cannot be accomplished through a standard action.

Use this method:

  • To work around actions currently unsupported by the agent; for example, right-clicks or clicks with modifiers.
  • To call JavaScript in the web application directly when an element cannot be reliably referenced through a locator (IE and Firefox agents only)
  • As a workaround to an agent bug.

Using this method

Within the Custom action Custom action, set the Target Window to the window or frame you want to interact with. It must follow the target window syntax. For more information, see Target property.

Target window setting in a Custom action

In the Chrome and Mobile agents, it is important that the Target Window value references the exact window and frame you want to execute JavaScript against. Chrome does not allow you to access the contents of a child frame from the parent window or frame.

In the Code field, write your custom JavaScript code. Write any DOM references as if you are executing the action from within the specified target window. Any JavaScript methods defined in the application that are accessible from that window can be used within your custom JavaScript code in Firefox and IE agent scripts.

These methods will not be accessible within this context in the Chrome and Mobile agents, because of the Chrome browser's architecture. In the Chrome and Mobile agents, JavaScript defined to run against a target window is executed as a content script. Content scripts do not have access to methods or variables defined within the web application. For more information on this Chrome limitation, refer to