Thanks for your reply. The problem is not just for pop up. It is for any browser windows. When application open the second browser, I need to set focus to it, click on some UI, do some verification, then close it. It is not the synchronization issue because the waitForElementPresent usually times out without detect it. I used "pause" and it failed too.
However, if I start again from the step, I can select it by title/name.
we also have a pdf generator in our application, and I use the following code, which works correctly
<font class="small">Code:</font><hr /><pre>
//here your steps inside the new window
//steps on the parent window
Press any key to continue, or any other key to cancel.