If a new pop-up window is shown and you want to perform actions in the new window, you have to first switch to the frame/window.
Use driver.switchTo().frame(1)
or Use driver.switchTo().frame("dropboxIframe") [Example switching to dropbox window]
You will have to know the name of the frame, which you can find using inspect element.
Also after switching to different window, always provide some Thread.sleep for few seconds for that page to load.
Once you are done with work on pop-up window and want to come back to default frame, use this:
driver.switchTo().defaultContent()