If an iFrame does not have a name or an id attribute, you can select it like this.
• First, get the iFrame as a WebElement
(by using xPath or CSS)
• Then pass the WebElement
into switchTo().frame( )
.then(() => {
logger.log(11, "get frame #root > div > div > div:nth-child(3) > iframe");
return $browser.findElement(By.css("#someCssSelectorForTheIframe"))
})
.then((iFrame) => {
logger.log(11, "get to frame #root > div > div > div:nth-child(3) > iframe");
return $browser.switchTo().frame(iFrame) // Ignore the warning given in New Relic. $browser.switchTo().frame(...) accepts $driver.WebElement
})