When you log into OpenCMS, it closes the window you are in, and opens a new one. With Selenium IDE the close() doesn't work, and everything is fine, but with RC I can't proceed:
(in java)
click("//input[@value='Login']");
After that, every command I try gets a "com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Current window or frame is closed!". eg selectWindow, openWindow, waitForPopup etc etc. I can find no way of pointing to the new window, or preventing old one from closing.
In IDE the original window doesn't close.
Hi Joan,
i don't understand which is the problem specifically.You can't select the new window because you don't have the WindowId? the new window doesn't load?
Could you paste the piece of code?
Saludos
Hi,
I was working with Joan on this issue. When logging into cms there is a login window and a workplace window. In the IDE the script is able to fully run and log into cms without errors.
When running this in ide this works but running as RC in a suite with other tests works randomly. The error message is com.thoughtworks.selenium.SeleniumException: ERROR: Threw an exception: Current window or frame is closed!
The problem is there are 2 windows and both are open but it thinks it thinks the workplace window is shut. How can I get selenium to get focus on the second window?
<tr>
<td>open</td>
<td>/opencms/opencms/system/login</td>
<td></td>
</tr>
<tr>
<td>waitForElementPresent</td>
<td>//form[@id='ocLoginForm']/div/table/tbody/tr[2]/td[2]/b</td>
<td></td>
</tr>
<tr>
<td>type</td>
<td>ocUname</td>
<td>Admin</td>
</tr>
<tr>
<td>type</td>
<td>ocPword</td>
<td>admin</td>
</tr>
</tbody></table>
</body>
</html>
Sharon,
To select the windows you use selenium.selectWindow("WindowID"); so you need to get both windows Id.
You must consider that before executing any command. So if you execute Open and the new window is loaded, first you have to select the new window and after that do the WaitForElementPresent.
Maybe you would find useful to look at selenium.WaitForPopup method.
Everytime you need to execute some command or evaluate something on a window you will have to select it first.
Hope this helps.
Saludos
Hi
This doesn't help me since cms doesnt have window ids only window names. I have tried selecting via window title/window names. I know this is selenium problem as a previous company I worked in also had this problem with cms systems where it does not recognise 2 windows are open. Why does this work in ide and not through RC?
I think u can do one thing for closing old browser use sel.stop(); and after that u can use sel.start(); for new browser.
So that focus will be there on the new window only.
selenium.selectWindow("");
selenium.click("link=Logout");
selenium.stop();
selenium.start();
selenium.open(http://10.60.5.69:8080/XXXX/index.jsp);
selenium.type("username", "uname");
selenium.type("password", "pass");
If windows doesn't have id selenium automatically allocate one to them.
Use the script below to find out those ids.
String script = "var windowId; for(var x in selenium.browserbot.openedWindows ){windowId=windowId + '&' + x;}"
As you can see it returns a string with the windows id separated by '&'. Split it and you can handle each window id to select the window.
Hi
We've already tried all this before but it doesn't work. Still thinks the window is closed. Has anyone had this problem with content management systems and found the solution.
cheers
S
Ok, i've got some example code ...
browser.type("ocUname", "Admin");
browser.type("ocPword", "admin");
browser.click("//input[@value='Login']");
browser.waitForPageToLoad();
browser.pause(2000);
try {
browser.getAllWindowTitles();
} catch (Exception e) {
System.out.println(e.getMessage());
}
ERROR: Command execution failure. Please search the forum at http://clearspace.openqa.org for error details from the log window. The error message is: win.document is null
This is using 1.0.1. When you "click" the window you are working on closes and another one opens. Just about every command gets an error.
<bump>
Any thoughts on how to work around this?
