Testing Selenium WebDriver:如何等待iFrame完全加载?可以单击iframe元素文本框id=“;第4单元1单元2单元1单元1-lnk和x201D;

Testing Selenium WebDriver:如何等待iFrame完全加载?可以单击iframe元素文本框id=“;第4单元1单元2单元1单元1-lnk和x201D;,testing,iframe,selenium,selenium-webdriver,Testing,Iframe,Selenium,Selenium Webdriver,问:我正在测试一个带有iframe的页面,iframe的内容是由JavaScript动态生成的。我必须等待iframe完全加载,以确保我需要的所有元素都存在 <iframe frameborder="0" style="border: 0px none; width: 100%; height: 290px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quot

问:我正在测试一个带有iframe的页面,iframe的内容是由JavaScript动态生成的。我必须等待iframe完全加载,以确保我需要的所有元素都存在

 <iframe frameborder="0" style="border: 0px none; width: 100%; height: 290px; min-width: 0px; min-height: 0px; overflow: auto;" dojoattachpoint="frame" title="Fill Quote" src=" =1&zTaskId=9309&zResetContext=true&coachDebugTrace=none>
   ------------------------------------------------
  <input id="div_4_1_1_1_1_1_2-in" class="p-field span12" type="text">
但它不起作用。而这个iframe只动态生成了他的标题

输出:

Nov 22, 2013 2:52:03 PM org.openqa.selenium.support.ui.ExpectedConditions findElement
WARNING: WebDriverException thrown by findElement(By.id: div_4_1_2_1_1-lnk)
org.openqa.selenium.remote.UnreachableBrowserException: Error communicating with the      remote browser. It may have died.

Selenium有一个解决问题的预期条件:

ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator)

我建议您阅读这篇文章,这篇文章有一个解决您问题的预期条件:

ExpectedConditions.frameToBeAvailableAndSwitchToIt(locator)
我建议你读一下这个和这个