One of my automation case has been blocked for more than 1 week, there is a lazy loaded iframe (clicking a link will insert this iframe into DOM), my code is like below:
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
Whenever I manually do the operation above, I am 100% sure after clicking the "REGISTER" button, there are totally two iframes on the page, i.e. if I do document.getElementsByTagName("iframe"), I can get two iframes! But during the automation running, it just always fails, I really don't know why, and more important, I did see debug tips for protractor and webdriverjs, however, I didn't figure out a good way to do the DOM query in the REPL, all because of webdriverjs' promise control flow, any experienced debugging tips here are highly appreciated!!