iFrame Support for Engine and Scripting Toolset

As of release 4.9.6, iFrame support has been added for the engine and scripting toolset in order to give users the option to create more extensive testing scripts. With this feature, users can adjust their scripts to handle not only regular HTML elements, but also the ones residing inside iFrames. 

The <iframe> HTML element represents a browsing context, embedding another HTML page into the current one. iFrames can be nested, which means you can have an iFrame (or multiple) nested inside one another. 

Our Engine, Application X-Ray, and Script Editor have added additional functionality to support this feature.

Application X-Ray

Upon starting a web browser, the page is scanned for any iFrame elements and the detected list of iFrames is made accessible through a dedicated dropdown element in the UI of Application X-Ray:


Things to keep in mind if it seems all iFrames are not being detected:

  • The tool lists only those iFrame elements, which are visible in the current view area of the opened page. To make other iFrames appear in the dropdown, users need to scroll-navigate.
  • Navigating to a different page or back to the previous one has to be done in the same tab which was initially opened by the tool. Other tabs will not be scanned.
  • If the page is dynamic (e.g. displays numerous alternating advertisements), the list of detected iFrames might visibly update quite often with the ever-changing contents of the page. iFrames which were detected previously might not be available anymore and instead replaced with new ones. 
  • While the dropdown is expanded, detection of iFrames is halted. It resumes whenever the dropdown is collapsed. Therefore, if it's a dynamic page and a few scans have been skipped, a stale frame might get selected by the user and a warning will appear. A couple of seconds after the dropdown is closed, the list will be updated.


When the user selects one of the iFrames in the dropdown, a yellow selection rectangle will mark the element, indicating to the user that it is the selected iFrame.

Sometimes the indicating rectangle might be off by a few pixels and incorrectly mark the bounds of the element. Users should check that their display scale is set to 100%. 

Once the iFrame has been selected, it is now possible to find and pick the control elements inside of it. At this point, Application X-Ray treats them like any regular HTML elements, unless there are other nested iFrames inside that would prevent from accessing those elements right away.  



After the control has been selected, it is possible for users to see code snippets that show how to switch to the current iFrame and perform actions on the inner controls:

It is a short preview, so some essential lines might be invisible. Therefore, it is recommended to use the icon beside the multiline text field and copy all contents to the clipboard. 


Engine / Script Editor  


The code snippets, mentioned above, can be inserted into user-written scripts. 

A few commands have been added to the scripting language that allow the script writer to switch to a specific iFrame. After switching, all operations (Find, Click, etc.) will occur in the context of that iFrame. 

Scripts are able to manipulate the contents of an iFrame with these commands:

  • SwitchToFrame(index:int) - switch to iFrame by providing its zero-based index. The first iFrame element from the top of a page has index zero (0), and the next iFrame one (1), and so on. The engine will generate a runtime error in case of negative index or non-existing index.
  • SwitchToFrame(name:string) - switch to iFrame by providing its name. This works only for iFrame with optional name attribute specified. The engine will generate a runtime error if there is no provided name, or the provided name is a non-existing name.
  • SwitchToFrame(element:IWebComponent) - switch to iFrame, reflected by web component obtained from one of FindWebComponent functions. The engine will generate a runtime error in the case of a null component or wrong component.
  • SwitchToFrame(Frames.Root) - back to main document of the page. Function returns true if the engine was able to switch to the main document, and otherwise returns false (for example, if the frames were never switched)
  • SwitchToFrame(Frames.Parent) - back to parent document of the current frame document. Function returns true if the engine was able to switch to the parent document, and otherwise returns false (for example, if the frames were never switched)