selenium "selectPopUp" example - selenium ide "deselectPopUp" command example

"selectPopUp" command
"selectPopUp" command works same as "selectWindow" command. Sometimes when you click on link then it is opening new window popup. If you want to perform some actions on new opened popup window then you need to select that popup first then and then you can perform any action on new window. In such
conditions, you can use "selectPopUp" command. Window ID or title is required as a target with "selectPopUp" command.

"deselectPopUp" command
opposite to "selectPopUp" command, "deselectPopUp" command will remove selection from popup window and will select main window. Do not required Window ID or Name as a target with "deselectPopUp" command. Let we see both commands with example.

New Test
CommandTargetValue
openhttp://www.w3schools.com/tags/
tryit.asp?filename=tryhtml_a_target

verifyTextPresentOpen link in a new window or tab
clicklink=Visit W3Schools!
pause2000
selectPopUpW3Schools Online Web Tutorials
waitForTextPresentLearn to Create Websites
verifyTextPresentLearn to Create Websites
deselectPopUp
verifyTextPresentOpen link in a new window or tab
verifyTextPresentLearn to Create Websites
selectPopUpW3Schools Online Web Tutorials
verifyTextPresent Learn to Create Websites

In above example, "click" command will click on link and open new window which has title = 'W3Schools Online Web Tutorials'. Now "selectPopUp" command will select new opened window with title = 'W3Schools Online Web Tutorials'. Next 2 commands ("waitForTextPresent" and "verifyTextPresent") will be executed on new opened window.

"deselectPopUp" command will remove selection from newly opened popup window and will select main window. Next 2 commands ("verifyTextPresent") will be executed on main window but 2nd "verifyTextPresent" command will return false because there is not such text ('Learn to Create Websites') present on main window page. Next command "selectPopUp" will once again select popup and then "verifyTextPresent" command will check for text 'Learn to Create Websites' on popup window and it will becomes pass because targeted text is present on popup window.

4 comments:

  1. Its not clicking on the link link=Visit W3Schools!

    ReplyDelete
  2. You must choose option and select allow to pop-up.Good luck!

    ReplyDelete
  3. How can I find out Window ID ?

    ReplyDelete
  4. How can I find out Window ID ?

    ReplyDelete