I am working on a application that opens a form to fill up when i click on a button. I need to switch to that window , fill up the form and come out I tried this code
Set beforePopup = driver.getWindowHandles();
//code to click on add button to open the pop-up
driver.findElement(By.xpath("//body[@id='ext-gen1018']/div[@id='contentPanel-1461']/div[@id='contentPanel-1461-body']/div[@id='campaigns-1464']/div[@id='campaigns-1464-body']/span[@id='campaigns-1464-outerCt']/div[@id='campaigns-1464-innerCt']/div[@id='campaignscoveragegrid-1494']/div[@id='toolbar-1507']/div[@id='toolbar-1507-innerCt']/div[@id='toolbar-1507-targetEl']/a[@id='button-1508']/span[@id='button-1508-btnWrap']/span[@id='button-1508-btnEl']/span[@id='button-1508-btnIconEl']")).click();
Set <String> wndHandler = driver.getWindowHandles();
Iterator <String> it = wndHandler.iterator();
String Parent = it.next();
String Child = it.next();
driver.switchTo().window(Child);
I am getting no such element exception