Selenium 2中的getAllWindowTitles方法表现不同

Selenium 2中的getAllWindowTitles方法表现不同,selenium,selenium-rc,webdriver,Selenium,Selenium Rc,Webdriver,我试图让我的旧Selenium RC测试在Selenium 2.0b2单机版上运行。我使用的是Selenium python驱动程序,没有使用WebDriverBackSelenium并排运行weddriver和Selenium测试的方法。这可能是一种方法,但这是一个单独的问题。因此,我面临着让Selenium 2与Firefox 3和4配合使用的问题。以下是我的测试示例: sel.open("window.html") sel.click("ff4button") for i in ran

我试图让我的旧Selenium RC测试在Selenium 2.0b2单机版上运行。我使用的是Selenium python驱动程序,没有使用WebDriverBackSelenium并排运行weddriver和Selenium测试的方法。这可能是一种方法,但这是一个单独的问题。因此,我面临着让Selenium 2与Firefox 3和4配合使用的问题。以下是我的测试示例:

sel.open("window.html")
 sel.click("ff4button")
 for i in range(60):
    windowname = sel.get_all_window_titles()
    print windowname
唯一可以找到的窗口是父窗口,在本例中称为基本窗口,这里是2个HTML文件的源

window.html源代码如下:

<html>
<head>
<title>Base window</title>
<script type="text/javascript">
function openwindow()
{
    window.open("test.html", "testwindow", "width=500,height=500");
}
</script>
</head>
<body>
<h1>Firefox 4 Selenium sample</h1>
<button id="ff4button" onclick="openwindow()">Open new window</button>
</body>
</html>
将打开test.html:

<html>
<head>
<title>testwindow</title>
</head>
<body>
<h1>New Window</h1>
</body>
</html>

任何人都知道为什么新窗口没有打开。在我将测试迁移到webdriver之前,至少运行Selenium 2.0b2对我来说是一个大问题。

我认为您遇到的这个问题是Selenium 2.0rc2的一个变种和一系列其他类似的错误,它们可能在Selenium 2.0rc2中得到了修复。

显然这是因为Selenium 2没有正式认证在Firefox 4上执行测试,这并不是说测试不会在Firefox4中运行。但是windows之间的交互和不使用WebDriver会导致问题Selenium 2.0b3不支持FF4,您可以尝试它。如果它部分工作,函数get_all_window_titles会找到打开的窗口,但名称不正确。我可能不得不重构我的测试以获得所有窗口标题并选择最后一个窗口,这在我看来是一个安全的假设,但希望他们在beta 4中解决这个问题