Quantcast
Channel: Active questions tagged frames - Stack Overflow
Viewing all articles
Browse latest Browse all 55

How to get total number of nested frames inside the frame

$
0
0

Snapshot of Frame_top with 3 nested frames:

Frame_top with 3 nested frames

Code:

WebElement topframe = driver.findElement(By.xpath("//frame[@name='frame-top']"));   String frame1 =  driver.switchTo().frame(topframe).switchTo().frame("frame-left").findElement(By.xpath("//body")).getText();                System.out.println(frame1);List<WebElement> nestedFrames = driver.switchTo().frame(topframe).findElements(By.tagName("frame"));System.out.println(nestedFrames.size());

On top you can see this page has nested frames inside the frame(frame_top).
Using line 1-3 I'm able to get the text of each nested frame. However I can't get number of frames inside the "Frame_top".(Line 4-5).
How do I get total number of frames inside the "frame_top"?Thanks in advance


Viewing all articles
Browse latest Browse all 55

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>