Time to upgrade! You only have until October 31, 2019 to move to Dynatrace, our all-in-one software intelligence platform. For details, see the Synthetic Upgrade Center and Dynatrace Synthetic documentation.

Simple iFrame count - IE and Firefox

This very simple code is an example of how to grab the number of iFrames on a page, and make a decision based on that count. In this example, we are checking to see if there is an iFrame on the page. If there is not (the count == 0), then we skip a step that would have interacted with the iFrame (we set it to "do not execute").

This code can be used for many different situations, though an iFrame popup is the most common. The variable frames contains the count of how many frames are on the page.

var loc = new Locator();
var currentWin = loc.findFrame('gomez_top[0]'); 

var frames = currentWin.frames.length;
if (frames === 0)
	script.steps[3].actions[4].type = 'do not execute';