Loading...

Handling iFriframe issue with akaAT Studio

A very common type of control used in website is the HTML iframe. And this control needs to be handled in a specific manner when testing. This article shows you how to handle iframes properly in akaAT Studio.

What is iframe?

An iframe (Inline Frame) is an HTML document embedded in another HTML document. The iframe HTML element is often used to insert the content from another source, such as an advertisement, into a Web page.

How to identify the iframe?

We can identify the iframes by below two ways by inspecting the element:

  1. Right click on the element, if there is a **tag **name available with **'iframe' **then the element is said to be in a frame.
  2. Right click on the page and if there is an option available with following options in the context menu then the element is available in frames.
    1. View frame source
    2. Reload frame
    3. This frame

Why is it important to know how to test iframes?

Verifying text and objects within iframes can be a challenge. For example, even though you can see a text displayed in an iframe, automation tools may not be able to detect the text. You have to tell your script how to traverse through a website's iframes structure and select the correct iframe where the text and its object are present.

Example #1: Switch to Frame

  1. Given that you want to capture the JQueryUI's Drag and Drop example (this draggable control is an iframe), as shown in the screenshot below, you can drag the 'Drag me around' object to other areas of the iframe.
  1. Given the situation where you opt not to specify the iframe parent for an element, in order to interact with the element, you need to use the keyword Switch To Frameto have akaAT focus on the parent iframe before being able to interact with the element.

The sample code below shows how to switch to the parent frame before using the drag and drop action on the elements within the iframe.

Example #2: Switch to Default Content

Whenever we switch to frames to handle certain features, we must switch back to the parent node to access other features of the application. If we do not switch back to the parent node, then your code looks for next locators within that same frame itself.

Switch used to switch back to the main window or parent window frame.

  • Step 1: Launching the browser navigating to frame present page by Open Browser method
  • Step 2: Switching to action frame with Xpath

  • Step 3: Get text from text area with its Xpath

  • Step 4: Using keyword “Switch To Default Content” to switch back to the parent node

  • Step 5: Using “Verify Equal” to compare between expected results and actual results of text area. In this situation, we call the variable “text” equals to the output of Get Text in step 3, comparing with the variable “expectedText”.

  • Step 6,7: Continue get text and verify equal after switch back to parent node.
  • Step 8: Close browser.

Common exceptions

Noted that  NoSuchFrameException or InvalidSwitchToTargetException exceptions are thrown when the target frame to be switched to doesn't exist.

 

 

Blog Posts

Image

Getting Started

Go to akaAT Download page to get the latest version of akaAT Studio. A suitable version for your system will be automatically detected and recommended for download...

Continue Reading...

Image

Define Test and Variables

In this chapter, we’ll first define the steps of the data-driven test. Then, we’ll define the required variables for this scenario. You’ll also find out how to manage variables in akaAT Studio...

Continue Reading...

Image

Multi-touch Actions in Mobile App

Multi-touch action often appears in gaming applications. This tutorial shows you how to perform a multi-touch action...

Continue Reading...

Image

Web Handling

What are Locators?
Locators are basically the HTML attributes of a web element. They help identify unique web elements on a page and command testing frameworks...

Continue Reading...

Image

Pop-up Handling

When performing automation testing, you may sometimes deal with pop-up dialog issue that needs to be handled differently from normal test objects. This tutorial shows you how to deal with pop-up controls....

Continue Reading...

Image

Alert Handling

What is an alert?
An alert is a JavaScript function which is used to notify users on a Web page. It displays a dialog with a specified message and OK/Cancel buttons...

Continue Reading...

Image

Textbox Handling

This tutorial illustrates how to handle Textbox, Checkbox, Radio buttons using akaAT Studio. The reference source code is provided at the end of the tutorial...

Continue Reading...

Image

iFrame Issue Handling

A very common type of control used in website is the HTML iframe. And this control needs to be handled in a specific manner when testing. This article shows you how to handle iframes...

Continue Reading...

Image

Dropdown Handling

A drop-down list (abbreviated drop-down; also known as a drop-down menu) is a graphical control element, similar to a list box, that allows the user to choose one value from a list...

Continue Reading...

Image

Static and Dynamic Test Objects Handling.

Test Objects are one of the most crucial parts of building a successful automation project. Some of them are static (do not change at all) and some of them are dynamic (they are dependent on some dynamically changing parameters)...

Continue Reading...