Automated Testing Frames in Selenium WebDriver

Testing frames (including iframes) in Selenium WebDriver

Zhimin Zhan
6 min readMay 9, 2022

--

A repost of my daughter’s article with permission and slight modification. I added it here for the convenience of my blog subscribers. You can find more Selenium examples like this one in my eBook: Selenium WebDriver Recipes in Ruby. This is also included in my “How to in Selenium WebDriver” series.

Frames are deprecated in HTML5. However, iFrames (inline frames) are still widely used in many web apps, in particular, large enterprise apps such as Microsoft SharePoint and Dynamic 365.

From my memory, over 50% client web apps I worked on used iFrames. So, a few years ago, I was shock to know that so-called popular Cypress did not support Frames, and others. How could a test automation framework/tool be so crippled? Especially, W3C standard-based Selenium WebDriver is so much better. (many people used Selenium WebDriver wrongly, see my other articles for more)

This tutorial will show you multiple ways to test web pages with frames in Selenium WebDriver.

Table of Contents:· iFrames vs Frames — What’s the Difference?
· Steps to Automated Testing page operations in a Frame
· How to Switch to a Frame?
Identify Frame by ‘ID’
Identify a frame by

--

--

Zhimin Zhan

Test automation & CT coach, author, speaker and award-winning software developer. Help teams succeed with Agile/DevOps by implementing real Continuous Testing.