title: How to handle overlay/popup window using selenium webdriver
body: <p>I am trying to automate initial configuration(of my server) through webpage. After hitting my server ip https:/localhost:4443 and entering my credentials ,i get a window to change password(overlay/popup window). </p>
  
  <p>Problem:- if i browse the same ip from another m/c or from another browser , i get a window over window i.e one more window over change password window(<a href="https://dl.dropboxusercontent.com/u/91420517/SelWd_popUpWindow.jpg" rel="nofollow">Please click the link to see the screenshot</a>).</p>
  
  <p>What i tried is to get the handle of the window but its not working, its providing one handle only.</p>
  
  <p>**Its not frame also.</p>
  
  <p>HTML code -- <a href="https://dl.dropboxusercontent.com/u/91420517/Html_Code.JPG" rel="nofollow">https://dl.dropboxusercontent.com/u/91420517/Html_Code.JPG</a></p>
  
  <p>Here's my code </p>
  
  <pre><code>    WebDriver driver=new FirefoxDriver();
      driver.get("https://localhost:4443/ControlPoint/");
      driver.findElement(By.xpath("//*[@id='name']")).sendKeys("xxxxxx");
      driver.findElement(By.xpath("//*[@id='pass']")).sendKeys("xxxxxx");
      driver.findElement(By.xpath("//*[@id='loginForm123']/div[6]/div[1]/div")).click();
  
      Set&lt;String&gt; winIds = driver.getWindowHandles();
      System.out.println("Total Windows --- " + winIds.size());    // its resulting the size as 1 which is not correct.
      Iterator&lt;String&gt; it = winIds.iterator(); 
      String mainWin=it.next();
      String changeWin=it.next();
      String shareWin =it.next();
      driver.switchTo().window(shareWin);
      String warning = driver.findElement(By.xpath("html/body/div[4234]/div[1]/span")).getText();  // to get the text on 3 window
      System.out.println(warning);
  </code></pre>
  
  <p>How to resolve this issue .Please help. Any other way to click on buttons on window 3.</p>