Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I'm having a problem retaining the focus after using the openWindow command in the IDE. This problem only applies when a second test case within the same test suite tries to interact with the newly-opened window. For example, I have a test suite consisting of separate test cases to do the following:

  • Log into site A
  • Enter some transactional data
  • Submit the transaction for approval
  • Open a new window and log into site B
  • Approve the transaction in site B and close the window
  • Continue processing the transaction in site A
  • If I do the test case 5 "site B" actions in the same test case as the "openWindow" (ie. merge test cases 4 and 5) then all commands execute without error. If I do the same actions in a different test case then the new window loses the focus and all Selenium commands are directed back to the original window.

    The interesting part of this is trying to identify and reselect the "new" window in step 5.

    Executing "selectWindow name=siteB_URL" in test case 5 results in the error message "Window does not exist. If this looks like a Selenium bug...".

    I then figured I'd call storeAllWindowNames and echo the results to at least see the window names Selenium knows about at various points. If I do this as the last two commands in test case 4 I get the expected result - "echo ,siteB_URL" is logged. If I do the same thing as the first two lines in test case five I get "echo ". This is the part that gets me - simply changing test cases seems to lose the reference to the new window.

    Has anyone come up with a workaround or solution to this problem in the Selenium IDE?

    I've spent several hours this morning scouring the web and various forums looking for suggestions to no avail.

    Thanks in advance,

    Glenn

    4-7-12 - Update - here's a simplified example of the scenario above:

    [info] Executing: |openWindow | http://www.google.com.au | google2 |
    [info] Executing: |selectWindow | google2 | |
    [info] Executing: |storeAllWindowNames | allWindows | |
    [info] Executing: |echo | ${allWindows} | |
    [info] echo: ,google2
    [info] Changed test case
    [info] Executing: |storeAllWindowNames | allWindows | |
    [info] Executing: |echo | ${allWindows} | |
    [info] echo:
    [info] Executing: |selectWindow | name=google2 | |
    [error] Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds. 
                    I have same problem. Did you solve this problem or it still open issue? Please share your experience!
    – herry
                    Mar 14, 2014 at 20:22
                    The problem is that Selenium loses the reference to the newly-opened window when moving from one test case to another.  From what I can tell this is a symptom of SEL-572 and/or SEL-703, both of which were raised in 2009 and are still open.  I don't believe selectFrame achieves anything here
    – Glenn Marsom
                    Jul 18, 2012 at 0:06
                    This problem can be reproduced by creating a test suite with two test cases - the first just does an openWindow, the second does a selectWindow.  If anyone has found a way to interact with the new window in test case 2 they would be a true champion and genius!
    – Glenn Marsom
                    Jul 18, 2012 at 0:11
            

    Thanks for contributing an answer to Stack Overflow!

    • Please be sure to answer the question. Provide details and share your research!

    But avoid

    • Asking for help, clarification, or responding to other answers.
    • Making statements based on opinion; back them up with references or personal experience.

    To learn more, see our tips on writing great answers.