iFrame Automation Using Python Appium

Modified on Mon, 24 Jun at 1:20 PM

iFrame Overview

An iFrame, short for "inline frame," is an HTML element used to embed another HTML document within the current document. It allows content from one webpage to be displayed within a designated area of another webpage. This enables website developers to integrate external content seamlessly into their own web pages. iFrames are commonly used for displaying advertisements, social media widgets, videos, and other types of content sourced from external websites.

Identifying iFrames in Web Browser Inspections

To verify whether an element is an iframe, you can inspect the element in your web browser. If the tag name of the element is <iframe>, or if its parent tag is <iframe>, then the page contains an iframe. You can identify iFrames by looking at the HTML structure of the webpage using the browser's developer tools.


Example 

Consider an example scenario where a user accesses an embedded video from the algoshack website, as shown:

You can perform the following leveraging algoQA

User Actions:

  1. Open the mobile browser.
  2. Navigate to the algoshack.com website.
  3. Wait for the embedded YouTube video to load.
  4. Interact with the controls of the YouTube video (play, pause, seek, etc.).
  5. Verify the title and description of the video.
  6. Switch back to the main content of the website.
  7. Navigate back to the algoshack.com website.
  8. Close the browser session.


Code snippet


GWT steps:

Given I have access to the algoshack.com home page

When I navigate to the webpage containing the embedded YouTube video
When I wait for 10 seconds  stay in home page

Then I selected the YouTube video displayed within an iframe
And I clicked the video controls (play, pause, volume, etc.)

And I  verify the video title and description

And I  navigate back to the algoshack.com website


Setting iframe XPath leveraging algoQA 


You can set the iframe XPath leveraging algoQA during the profiling process.

Perform the following:

  1. Navigate to the Main Canvas after creating an offline model. 
  2. Edit the node on which you wish to add the iFrame ID. 
  3. Control List Panel window appears. In this window, click the icon to update the iFrame ID (XPath) in the following format as shown:
    XPath = //a[contains(.,'algoQA')] || <iFrame ID>. Refer to the following image for more details: 
    
    


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article