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.

Working around dynamic frames for IE and Firefox Agents

Some applications require that a user interact with a specific frame, and the location of that frame may change from one test run to another. This dynamic behavior makes it impossible to specify a static targetWindow reference because the frame index is constantly changing. This topic outlines one way to work around the problem.

Before you begin

You must be able to do the following:

  • Properly locate the target frame of the parent window and determine if it fits this use case.

  • Script within the control scope

  • Properly reference the dynamic frame by its HTML attribute and build its target window.


The Chrome browser's architecture prevents scripting access to child frames from within the parent window. Currently, there is no workaround for this limitation in the Chrome and Mobile agents.

  1. Record the script.

  2. Play back the script.

  3. Troubleshoot the script to see whether it is failing because it is unable to find the frame target window.  

    You can use Firebug or a similar tool.

  4. Insert a Custom action ![Custom action]( ahead of the action where the target window is changing.  

    Set the Target Window to control .
    Target window set to 'control'

  5. In the **Code**  area, write a JavaScript action to do the following:
    1.    Define a new Locator object for the parent window of the dynamic frame to interact with.
    2.    Store the parent window's child frames into an array.
    3.    Traverse the array and finds the target window of the dynamic frame using its HTML attribute.
    4.    Create a string value with the location of the target window, including the dynamic frame index; and assign that value to a global variable.
    5.    Input the string value of this target window into the **Target Window**  field of the next action.  

      This can be done within the JavaScript by referencing the action within the script's JSON model; or, the global variable can be accessed using the backtick method within the appropriate action.

Sample code

The following sample code can be used to work around a dynamic frame or iFrame within the parent window gomez_top[0] . You must know the parent window to begin with. The code can be modified to apply to dynamic popup window.

This custom code is executed within the control scope.

 // Find the dynamic frame
var loc = new Locator();

// Locate the parent window
var currentWin = loc.findFrame('gomez_top[0]');

// Get all children frames under the parent window
var frames = window.external.getFrames(currentWin)
alert("Frames: "+frames.count());

// Traverse the children frames
for (var i=0;i<frames.count();i++) {

// Find the target frame using its attribute
  if (frames.get(i).document.title.indexOf("Gomez") > -1) {
     newWindow = "gomez_top[0].frames["+i+"]";

// Set the target window on the third action in step 4 to the frame found
script.steps[3].action[2].target.targetWindow = newWindow;