I am trying to fetch of Frame after switching but it is still returning Title of Main WebPage. Sharing code and DOM details of Frame:
WebDriver driver = new ChromeDriver();
driver.get("http://www.dwuser.com/education/content/the-magical-iframe-tag-an-introduction/");
List<WebElement> IframaList=driver.findElements(By.tagName("iframe"));
System.out.println("total number of frame is "+IframaList.size());
for(WebElement e : IframaList){
System.out.println( e.getAttribute("name"));
}
driver.switchTo().frame("myDemoFrame");
System.out.println(driver.getTitle());
Dom Structure :
Note: I checked RemoteWebdriver Implementation of gettitle() and It says that It returns the title of Page. Does it mean the Title of the WebPage only?
The function getTitle() only returns the top level Title
Refer to the document below for more info.
This command returns the document title of the current top-level browsing context, equivalent to calling document.title.