"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 | ||
Command | Target | Value |
open | http://www.w3schools.com/tags/ tryit.asp?filename=tryhtml_a_target | |
verifyTextPresent | Open link in a new window or tab | |
click | link=Visit W3Schools! | |
pause | 2000 | |
selectPopUp | W3Schools Online Web Tutorials | |
waitForTextPresent | Learn to Create Websites | |
verifyTextPresent | Learn to Create Websites | |
deselectPopUp | ||
verifyTextPresent | Open link in a new window or tab | |
verifyTextPresent | Learn to Create Websites | |
selectPopUp | W3Schools 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.
Its not clicking on the link link=Visit W3Schools!
ReplyDeleteYou must choose option and select allow to pop-up.Good luck!
ReplyDeleteHow can I find out Window ID ?
ReplyDeleteHow can I find out Window ID ?
ReplyDelete