0

I have been trying to find if there is any way to find out the iframe name from Firebug, without having to use its built-in console.

I am aware that window.frames[x] will switch the window handle to "x"frame, but is there any way to just find out the name of the frame without having to use console, so that I can use the frame name in my Automation script?

I am now using Firepath to get the name of the frame, however, I was wondering if the same can be done using Firebug.

Thanks!

user6376
  • 3
  • 1
  • 4

1 Answers1

0

A simple way to find frames within the DOM structure is to use the HTML panel´s search (which allows to search for XPaths). So, just type in //frame (or //iframe for iframes) and you´ll be able to navigate through the different / elements.

The frames are also listed within the DOM panel.

Firebug also offers you a way to switch between different frame contexts via the cd() command, but it does not have a visual option for that. Though the Firefox DevTools implement a button, which lists the different frames in a popup menu.

If you mean the name attribute when you speak about 'name', you can also get them easily using the following code:

var frames = document.querySelectorAll("frame, iframe");
var frameNames = [];
for (var i = 0; i < frames.length; i++) {
  frameNames.push(frames[0].getAttribute("name"));
}
Sebastian Zartner
  • 18,808
  • 10
  • 90
  • 132