1

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:

  1. Log into site A
  2. Enter some transactional data
  3. Submit the transaction for approval
  4. Open a new window and log into site B
  5. Approve the transaction in site B and close the window
  6. 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. 
Glenn Marsom
  • 11
  • 1
  • 4
  • I have same problem. Did you solve this problem or it still open issue? Please share your experience! – herry Mar 14 '14 at 20:22

3 Answers3

0

Have you check it with following commands?

selectFrame | relative=up
selectFrame | iframe name
Prashant Vadher
  • 1,057
  • 11
  • 9
  • 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 '12 at 00: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 '12 at 00:11
0

Try with option:

selectWindow()

Just provide the window title name within ().

For Ex: Window Title is Testing, then

command : selectWindow
title : Testing 

To know the title of the newly opened window follow the steps:

Go to the new window

Right click->view page source

Press ctrl+F.

Type title and search.

You will get the title of the new window.

I hope this helps... Thanks Sathiya

Robert
  • 5,278
  • 43
  • 65
  • 115
sathiya
  • 279
  • 1
  • 5
  • 17
0

//on the original window...

command: store window handle

target: myVar

//...do whatever...

command:select window

target: handle=${myVar}