How to get total number of nested frames inside the frame
问题 Snapshot of 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