Working with the multiple windows in selenium IDE is not hard. Many selenium IDE users asking me for this question so let me try to explain it. You need to handle multiple windows many time of software applications regression testing using selenium IDE or any other tools. As you all knows, selenium IDE is not too much
powerful tool compared to others software testing tools like Webdriver, we have to handle few things manually in selenium IDE. Bellow given case is not fully recorded but updated few commands manually after recording. Let we look at the example.New Test | ||
Command | Target | Value |
open | http://www.bing.com | |
storeTitle | i | |
openWindow | https://www.google.com | |
pause | 5000 | |
selectWindow | ||
clickAndWait | css=#gb_2 > span.gbts | |
storeTitle | j | |
selectWindow | ${i} | |
clickAndWait | css=#scpt1 > a | |
storeTitle | i | |
selectWindow | ${j} | |
close | j | |
selectWindow | ${i} | |
close |
Handling Multiple Windows Test case explanation :
- Selenium IDE will open 'bing' home page.
- "storeTitle" will store bing home page title in variable 'i' to reuse it latter.
- "openWindow" will open Google home page in new window and next pause command will pause selenium IDE for 5 secs.
- Now we want to do some actions on newly opened window but we can not do any thing directly in new window. First of all we have to select new window. Next "selectWindow" command will select new window of Google home page.
- Next command will click on Google's image link.
- Now suppose i want to do some actions on parent 'bing' home page window. Before selecting parent window, "storeTitle" command will store latest title of page in variable 'j' so It will help selenium IDE to find this child window again when you want to perform some action on it.
- Next commands will select parent 'bing' window and click on image link. (You can do more actions here.)
- "selectWindow" command will select child window and next close command will close popup window.
- Last 2 commands will do same thing on parent window.
Keep one thing in mind during navigating between multiple windows of software application - Before leaving current selected window, Always store latest window title of your current selected window and then select other windows. You can try above case with some other sites.
I wonder what is the exact Difference between "open" and "openWindows"
ReplyDeleteIt takes a while for my page to load. Should I therefour use "openWindow" instead of "open" ? Perhaps there is a better way to wait as using "waitForPageToLoad" ?
Kind regards,
Enno Weerts
Open command will open URL in current open window while openWindow command will open new window and then open URL in new window.
DeleteI am new selenium IDE I wrote the above script as it is, but when I run this script it gives error at " OpenWindow" command. please can anybody can help me?
DeleteThis is Error
[warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank3295
[error] Unexpected Exception: TypeError: result is null.
@Hafiz Anas,I also having cases like you :(((
DeleteFirst you have to use Open Command to open current URL and save the title of current URL by using getTitle in any variable so that next time when you want to come back from new window to this window. This variable you can use as a referrence. Now If use openWindow command to open new URL and perform actions by using selectWindow
DeleteVery Good explanation. Thanks! for your efforts.
ReplyDeleteI am facing some problem with webpage dialog. As i am unable to open it and for webpage dialog id/name/title also not available. Could plz help me to solve this problem.
ReplyDeleteCould plz help me to solve this error - it will come when openWindow https://www.google.com command execute, [error] Unexpected Exception: TypeError: result is null. fileName -> chrome://selenium-ide/content/recorder.js, lineNumber -> 74, columnNumber -> 0
ReplyDeleteCheck for browser popup is allowed or not. If not allowed then allow it first any retry test.
DeleteAfter Executing openWindow=https://www.google.com , it show [warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank49198
ReplyDelete[error] Unexpected Exception: TypeError: result is null.
Please check the Base URL... Keep the Base URL as https://www.google.com
DeleteElse, set the Target as "/".
and Value as https://www.google.com.
If I keep Target as "/" when working with single window, '[warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank49198' does not appear.
DeleteBut while working with multiple windows, if I keep Target as "/" for second window, it always open base URL else, if keep Target as "https://www.google.com" it gives this warning.
How to handle '[warn] Opening window '_blank', which is not a real window name...' while working with multiple windows?
Hi Gital, I also faced that error and my solution is: open Options > Contents > Pop-ups > uncheck Block pop-up windows box. Hope this help.
DeleteWhether E-Mail subscription is chargeable???
ReplyDeleteEverything Including email subscription Is free on this blog
DeleteI got below error ....
Delete[info] Executing: |openWindow | https://www.google.com | |
[warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank62911
[error] Unexpected Exception: TypeError: result is null.
Hi there,
ReplyDeleteOne query, In the third last command we are closing "i". and then again we are selecting "i".
Please confirm how we do that as once we are closing "i" and again selecting it.
Is store title changes the content dynamically.
Please correct me if I'm missing anything here!
Thanks,
Ashu
That was type error. Written i at place of j. Now It Is corrected. Thanks.
DeleteThis comment has been removed by the author.
ReplyDelete[error] Element css=#gb_g > span.gbts not found
ReplyDeleteHi, replaces "link=Imágenes" by "css=#gb_g > span.gbts" and working properly
Deleteexcellent post!!
Hi,
ReplyDeleteWhen i was trying the above commands, i encountered a problem in 8th command i.e "selectWindow ${i}". The error message displayed in the selenium log is "[error] Could not find window with title Bing". How can i overcome this error?
Hi! :)
ReplyDeleteOur current set up is when a link is ticked, the link opens on a new tab, instead of window. Does Selenium IDE have a command for automating this action? Thank you. :)
No
DeleteI am new Selenium IDE I wrote the above script as it is but it gives error when it reaches on " openwindow" command. please can anybody help me out?
ReplyDeleteError Message
[warn] Opening window '_blank', which is not a real window name. Randomizing target to be: selenium_blank3295
[error] Unexpected Exception: TypeError: result is null.
open Options > Contents > Pop-ups > uncheck Block pop-up windows box. Hope this help.
DeleteHi, I am getting the below error when the above script is run:
ReplyDelete[error] Unexpected Exception: TypeError: result is null.
Can you advice where i am stuck?