Unable to do any action in list which is opened in new window after changing control. 
I have a parent window after clicking an <img> it's opening the list of values, in a list with new window. I have changed the control to new window using below code 
    for (String handle : driver.getWindowHandles()){
        driver.switchTo().window(handle);
    }
    driver.findElement(By.cssSelector("a[id='dynshlp_sel_2-rowsel']"));
After that I was not able to do anything. I need to click dynshlp_sel_2-rowsel. But 
the program is not clicking the element also it is not displaying any error unless I close the new window.
It is throwing an error stating unable to locate the element after I close the new window.
I'm new user to this site and I don't know how to add screenshot for this issue.
HTML CODE:
    <td id="dynshlp_sel_2" class="th-clr-nsel th-clr-cel">
        <div style="text-align:center;">
            <a id="dynshlp_sel_2-rowsel" class="th-lk" title="Select table row" href="javascript:void(0);" onfocus="thtmlbSaveKeyboardFocus('dynshlp_sel_2-rowsel');"></a>
        </div>
    </td>
    <td class="th-clr-cel th-clr-pad th-clr-cel-dis th-clr-cel-first-col" style="width:000056%; 
My Code: String mwh=driver.getWindowHandle(); driver.findElement(By.cssSelector("a[id='C20_W57_V58_V59_V60_marketing_struct.classific-btn'] > img:nth-child(1)")).click(); //above click will open a Popup window System.out.println(driver.getWindowHandles().size()); Set s=driver.getWindowHandles();
    //this method will gives you the handles of all opened windows
    Iterator ite=s.iterator();
    while(ite.hasNext())
    {
        String popupHandle=ite.next().toString();
        if(!popupHandle.contains(mwh))
        {
                    driver.switchTo().window(popupHandle);
                    driver.findElement(By.cssSelector("a[id='dynshlp_sel_2-rowsel']"));
                    //**here you can perform operation in pop-up window**
                    //After finished your operation in pop-up just select the main window again
                    driver.switchTo().window(mwh);
        }
    }