title: Selenium - How to get all frames with Pom Object pattern and PageFactory?
body: <p>The Webpage contains 2 frames.</p>
  
  <p>My Selenium script :</p>
  
  <pre><code>@FindBy(how = How.XPATH, using = ".//iframe") private List &lt;WebElement&gt; framesList;
  
  public myPage (WebDriver driver){        
      this.driver = driver;
      PageFactory.initElements(driver, this);
  }
  
  public void goFrame2() {            
      if (framesList.size() &gt;= 1) {
          driver.switchTo().frame(framesList.get(1));
      }
  }
  </code></pre>
  
  <p>When I execute the script, the size of the liste framesList is always 1. Just one frame is detected. If  I add a Thread.sleep of 5 seconds before PageFactory.initElements(driver, this); the second frame is detected and the size of the list is 2.</p>
  
  <p>Of course I don't want to use a Thread.sleep.
  How to detect the 2 frames properly?</p>
  
  <p>Julien</p>