Automatic switch to previous window after closing a child window is not happening.

10 views
Skip to first unread message

Indu Naraparaju

unread,
Oct 1, 2016, 12:02:08 AM10/1/16
to Selenium Users
Hi,

We are using Selenium Chrome driver (C#) to automate our site testing process. I got stuck at this step: the parent/previous window is not getting control if the pop-up window is closed. I am not sure how to handle it.
steps:
1. Site is loaded using chrome driver.
2. Clicking on a link on the site will pop-up a new window.
3. Switching to the new pop-up window.
4. Clicking on a link on the pop-up is displaying an alert box.
5. Switching the focus to alert box and saying .Accept() on it.
6. This "Alert.Accept()" is closing the pop-up window (that is how the site is designed, if you hit ok on the confirmation, the pop-up is closed).
7. Here my code is throwing a timeout error because it is not able to load the webdriver.

My question is, how can we handle cases like this? And why isn't the control transferring from pop-up window back to parent or previous window when the pop-up is closed?

Thanks,
Indu.
Reply all
Reply to author
Forward
0 new messages