You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.
When I try to select a window using selectWindow like so:
selenium.selectWindow("var=popupWindowVar");
I get an error stating that the window cannot be found. I set the javascript variable
like so
window.popupWindowVar = window.open("popup.html", "popupWindowID");
Here's the stats
Selenium version: 2.17
OS: Windows 7
Browser: Firefox 9.0.1
Here is a sample test case. I've attached the Java test case, and the "index.html"
and "popup.html" that I use in the test.
///////////////////////////////////////////
package org.example;
import static org.junit.Assert.assertEquals;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.DefaultSelenium;
public class SeleniumIntegrationTest {
private static SeleniumServer server = null;
private DefaultSelenium selenium = null;
@BeforeClass
public static void oneTimeSetUp() throws Exception {
// Create a configuration to override defaults.
RemoteControlConfiguration rcc = new RemoteControlConfiguration();
rcc.setTimeoutInSeconds(60);
rcc.setPort(4444);
rcc.setSingleWindow(true); // Support Popups
rcc.setTrustAllSSLCertificates(true); // Trust SSL
// Start the Selenium Server.
server = new SeleniumServer(false, rcc);
server.start();
}
@AfterClass
public static void oneTimeTearDown() throws Exception {
server.stop();
}
@Before
public void setUp() throws Exception {
// Create a Selenium thread.
// Open in Firefox
selenium = new DefaultSelenium("localhost", 4444,
"*firefox3",
"http://localhost:8080/");
selenium.start();
}
@After
public void tearDown() {
// Stop the Selenium thread.
selenium.stop();
}
@Test
public void popupWindowExample() {
// Open the base window.
selenium.open("index.html");
assertEquals(selenium.getTitle(), "Popup Window Example");
// Click button to popup new window.
selenium.click("id=popupButton");
// Select the popup window.
// popupWindowID is the ID given in the window.open javascript.
selenium.waitForPopUp("popupWindowID", "30000");
selenium.selectWindow("name=popupWindowID");
assertEquals(selenium.getTitle(), "Popped Up Window");
// Click a link to google on the popup.
selenium.click("link=This link goes to google");
selenium.waitForPageToLoad("30000");
assertEquals(selenium.getTitle(), "Google");
// Select the original window.
selenium.selectWindow("null");
assertEquals(selenium.getTitle(), "Popup Window Example");
// Select the window by a javascript variable.
// THIS FAILS IN FIREFOX!!!
selenium.selectWindow("var=popupWindowVar");
assertEquals(selenium.getTitle(), "Google");
}
}
Try switching by the window name.
Also, all active development is focused on WebDriver, not Selenium RC, so I'm lowering
this bug's priority accordingly.
Originally reported on Google Code with ID 3270
Reported by
tony.zampogna
on 2012-01-25 03:07:39- _Attachment: [SeleniumIntegrationTest.java](https://storage.googleapis.com/google-code-attachments/selenium/issue-3270/comment-0/SeleniumIntegrationTest.java)_ - _Attachment: [index.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-3270/comment-0/index.html)_ - _Attachment: [popup.html](https://storage.googleapis.com/google-code-attachments/selenium/issue-3270/comment-0/popup.html)_
The text was updated successfully, but these errors were encountered: