For over a week now, one of my automation test cases has been stuck due to a lazy loaded iframe (the iframe is inserted into the DOM only after clicking a link). Here's an excerpt from my code:
driver.get("my url");
driver.findElement(By.linkText('REGISTER')).click();
driver.wait(function() {
console.log("WAITING FOR EXTERNAL IFRAME");
return driver.findElement(By.css("div#main-container > iframe")).isDisplayed();
}, 8000, "WAIT TIMEOUT!!!!");
driver.switchTo().frame(1); // The iframe has no id and I have no control
// Manipulating in the iframe
When I manually perform the steps mentioned above, I can confirm that there are two iframes on the page after clicking the "REGISTER" button. However, during automation, it consistently fails without any clear reason. I have tried looking for debugging tips for protractor and webdriverjs, but navigating through the DOM query in the REPL seems challenging due to webdriverjs' promise control flow. Any experienced advice on debugging techniques would be greatly appreciated!