title: Finding active iframe with Selenium
body: <p>i am trying to navigate a page with Selenium WebDriver, and have the problem, that there are up to 3 iframes in this page, but only one is "active" the others are set on display: none
  everytime i move from one page to another, the new page is loaded in another iframe, but it seems there is no pattern to it, so i cant use </p>
  
  <pre><code>_driver.findElements(By.tagName("iframe")).get(index);
  </code></pre>
  
  <p>the iframes look like this :</p>
  
  <pre><code>&lt;iframe id="IF0" class="SOMETHING" width="100%" scrolling="no" height="100%" frameborder="0" target="main" src="../myPath/Blank.html" name="IF0" style="position: absolute; border-width: 0px; width: 100%; height: 100%; display: block; z-index: 10;"&gt;
  
  &lt;iframe id="IF1" class="SOMETHING" scrolling="no" frameborder="0" name="IF1" style="display: none; position: absolute; width: 100%; height: 100%; overflow: hidden; z-index: -1;"&gt;
  
  &lt;iframe id="IF2" class="SOMETHING" scrolling="no" frameborder="0" name="IF2" style="display: none; position: absolute; width: 100%; height: 100%; overflow: hidden; z-index: -1;"&gt;
  </code></pre>
  
  <p>i tried to use By.xpath like</p>
  
  <pre><code>WebDriverWait wait1 = new WebDriverWait(_driver, 60);
      wait1.until(ExpectedConditions.frameToBeAvailableAndSwitchToIt(By
              .xpath("//*[@target='main']")));
  </code></pre>
  
  <p>but it didn't work. Is there any other way to find out which iframe is visible without trying to load them one by one using Exceptions? </p>