title: Unable to handle showModalDialog window in Selenium Webdriver(Java)
body: <p>I am automating a web application using Selenium webdriver(java). I have handled popup windows in other parts of application but i'm not able to handle showModalDialog window. Application has read only text box and I have to fill this by clicking Search button, which will open new popup window.</p>
  
  <p>HTML code for this Textbox and Serach button is as follows.</p>
  
  <pre><code> &lt;tr&gt;
   &lt;td&gt;&lt;label class="classLabel"&gt;Textbox&lt;sup class="mandatory"&gt;*&lt;/sup&gt;&lt;/label&gt;&lt;/td&gt;
   &lt;td&gt;&lt;input type="text" name="textbox" value="" readonly="readonly" class="someTextbox"&gt;
   &lt;img src="/Some/url/search.gif" alt="Select Help" onclick="launch2()" /&gt;
   &lt;/td&gt;
    &lt;/tr&gt;
  </code></pre>
  
  <p>After clicking Search button, a showModalDialog window will open and there I have to click a radio button to fill text box.</p>
  
  <p>This showModalDialog window has iframe element and below is html code for this.</p>
  
  <pre><code>  &lt;iframe src="/some/url.do?parameter=getData" width='100%' height='100%' border=0 &gt;  
    &lt;/iframe&gt; 
  </code></pre>
  
  <p>Below is the code I'm using to switch into popup window and select iframe. Here, test case is simply stopping after clicking Search button and popup window also appearing but it is not handling popup. </p>
  
  <pre><code>     driver.findElement(By.cssSelector("img[alt=\"Select Help\"]")).click();
       String winHandleBefore = myD.getWindowHandle();        
         for(String winHandle : myD.getWindowHandles()){
         driver.switchTo().window(winHandle);
          }
         driver.switchTo().frame(0);
             driver.findElement(By.name("hier_data_id")).click();
  </code></pre>
  
  <p>If anybody have idea on how to handle showModalDialog windows, it would be really helpful. Suggestions would be appreciated.
  Thanks in advance !</p>