title: Sharepoint modal window handling through Selenium webdriver
body: <p>I am automating the sharepoint application using Selenium webdriver.</p>
  
  <p>On clicking one link to add the new item to the list, it opens the window/frame (not sure of), sort of modal pop up window. while executing the script, it is giving error of unable to locate element. In the below image, when i used to find all the window handles using <code>driver.getwindowhandles()</code>, it just gives 1 window as the parent window. and not the child window. The same code is able to run through selenium IDE but not thru JUnit. please help how can i handle this thing.</p>
  
  <pre><code>driver.findElement(By.xpath("//div[@id='zz9_V4QuickLaunchMenu']/div/ul/li[4]/a/span/span")).click();
  driver.findElement(By.id("idHomePageNewLink")).click();
  Thread.sleep(5000);
  </code></pre>
  
  <p><strong>//gives error at this point which is the id of the text field on child popup window.</strong></p>
  
  <pre><code>driver.findElement(By.id("ctl00_m_g_99918f84_a256_44b4_819e_982688a9f15c_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_UrlFieldUrl")).clear();        
  driver.findElement(By.id("ctl00_m_g_99918f84_a256_44b4_819e_982688a9f15c_ctl00_ctl05_ctl00_ctl00_ctl00_ctl04_ctl00_ctl00_UrlFieldUrl")).sendKeys("http://efgh");
  System.out.println("Done!!!!");
  </code></pre>