Try this before calling
driver.switchTo().window(parentwindow);
you should call
driver.switchto.defaultcontent .