title: Wedriver Windows popup handling
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/3837115/display-image-from-url-retrieved-from-alasset-in-iphone">display image from URL retrieved from ALAsset in iPhone</a>  </p>
  </blockquote>
  
  
  
  <p>My code is:</p>
  
  <pre><code>Set&lt;String&gt; windowsid = driver.getWindowHandles();
  Iterator&lt;String&gt; iterate = windowsid.iterator();
  
  while(iterate.hasNext()){
      System.out.println(iterate.next());
  }
  
  String mainwindow_id = iterate.next();
  String tabbedwindow_id = iterate.next();
  </code></pre>
  
  <p>I get an error @ <code>String mainwindow_id = iterate.next();</code></p>
  
  <p>Stating the below, Line 45 is the one i have in quotes.   <br>
  I have declared the <code>Set</code> as <code>String</code></p>
  
  <p>Please Help !</p>
  
  <pre><code>Exception in thread "main" java.util.NoSuchElementException
  at java.util.LinkedHashMap$LinkedHashIterator.nextEntry(LinkedHashMap.java:375)
  at java.util.LinkedHashMap$KeyIterator.next(LinkedHashMap.java:384)
  at windows.traverse.main(traverse.java:45)
  </code></pre>