I am automating the sharepoint application using Selenium webdriver.
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 driver.getwindowhandles(), 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.
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);
//gives error at this point which is the id of the text field on child popup window.
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!!!!");