I have a very complex html page.
Solution 1:
The answer depends on what you want to do with the list of iframes.
If you want all the list, you can try using recursive function.
publicvoidgetAlliFrames(){
List<WebElement> iframes = driver.findElements(By.tagName("iframe"));
if(iframe.count() > 0){
driver.switchTo().frame(iframe.get(0));
getAlliFrames();
}else{
System.out.println("No more iframes");
}
}
PS: This is an untested code and just provided for your reference.
Post a Comment for "How To Get All The Iframes In A Page"