How to use "selectWindow" and "waitForPopUp" Commands example in selenium

"waitForPopUp" Command

Remember one thing that selenium IDE software automation testing tool can handle only one window at a time. When you are taking some action like clicking on link or button and open new popup window then how to handle it in selenium IDE software automation tool? "selectWindow" command will help you to select window but before that you need to verify that your expected window is open or not. "waitForPopUp" command will help you to wait until your expected window is not open. 

You can give JavaScript window "name" of the window in to target of "waitForPopUp" command. If you leave target blank or "null" then "waitForPopUp" will wait for the first non-top window to appear. Put
timeout period into value field for how much time to wait for popup. If you are working with multiple popups then don't rely on this command.

In bellow given example, "waitForPopUp" command will wait for the popup window for 30 seconds.

New Test
CommandTargetValue
openhttp://www.software-testing-tutorials-automation.com/
typename=emailyouremailid @xxx.com
clickcss=input[type="submit"]
waitForPopUp
30000
selectWindowtitle=FeedBurner Email Subscription
assertTitleFeedBurner Email Subscription
verifyTextPresentThank you for your request

"selectWindow" Command
When you are working with multiple windows then "selectWindow" command is useful to select any window. You can use software web application's window title or internal JavaScript "name," or JavaScript variable of that window in target field. 
In above given example, "selectWindow" command will find window with title=FeedBurner Email Subscription and select that window to perform all next actions.

If you will give target as a null then again selenium IDE software tool will select main window. "selectPopUp" Command is very similar to "selectWindow" command.

7 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Thank you. nice post. To stop the selenium server until u get a popup, see this post http://coding-issues.blogspot.in/2012/11/selenium-waitforpopup.html

    ReplyDelete
  3. Please what would be the command needed to close a popup window??

    ReplyDelete
    Replies
    1. You can use "close" Command to close the popup window. It will close only current selected window. So if you want to close popup window then first of all select it using selectWindow command and then close it

      Delete
  4. Hi,

    I tried to execute this command but I am facing some issue in 'assertTitle' command. When I execute this, I get error that is '[error] Could not find window with title FeedBurner Email Subscription'. But it appears on the Top of the window. Please suggest me.

    ReplyDelete
  5. [info] Executing: |waitForPopUp | | 30000 |
    [error] Timed out after 30000ms
    how do i resolve this error, the pop up window does not appear

    ReplyDelete
  6. Hi Padmaja! Maybe.. You can to use: setSpeed | 3000| on this moment ...until the element to show. Or.. waitForFrameToLoad | id= id_popup_or_content_body .
    I have a example in my application, just like:

    ...
    waitForFrameToLoad | id=content
    windowsFocus | title = title_popup
    or
    selectWindow | title = title_popup

    I hope have helped you!

    ReplyDelete