【问题标题】:Running Selenium Test in Firefox with Robot Framework on Mac OS X Results in Hanging Selenium Server / Blank Browser Window在 Mac OS X 上使用 Robot Framework 在 Firefox 中运行 Selenium 测试会导致 Selenium 服务器挂起/浏览器窗口空白
【发布时间】:2012-03-24 09:57:12
【问题描述】:

我对使用机器人框架进行自动化测试很感兴趣。

我创建了一个使用

的测试脚本
  • Robot Framework v2.6.3(由 Python v2.6.1 提供支持)
  • SeleniumLibrary for Robot v2.8
  • Selenium 服务器 v2.3

我的操作系统是 Mac OS X 10.6.8 (Snow Leopard)。

我的测试在使用 Chrome 驱动程序的 Google Chrome 上运行良好。但是,Chrome 不支持截取页面截图,这是我离不开的功能。

于是我尝试在支持页面截图的火狐v10.0.2中运行测试,结果不行。

当我开始测试时,会弹出一个 Firefox 窗口,显示一个空白页面,在我杀死 pybot 之前什么都没有发生。

我尝试使用 Robot 启动 Selenium 服务器并自己从命令行启动 Selenium 服务器,但均无济于事。

我还尝试设置一个干净的 Firefox 配置文件供服务器使用,但这也没有帮助。

我还尝试了更新的 Selenium2Library for Robot Framework (v0.5.2),在 Chrome 中运行良好,但在 Firefox 中却不行。

我还尝试了一个更简单的“hello world”类型测试,基本上只是打开 www.google.com - Firefox 仍然没有运气。

在所有这些情况下,行为都是相同的:

  • 空的 Firefox 窗口打开
  • 机器人框架打印测试用例的名称,然后停止
  • Selenium 服务器显示“正在启动 Firefox”,然后停止

Selenium 服务器的日志文件显示了无穷无尽的列表:

21:06:33.285 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1800 more secs
21:06:33.286 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
21:06:34.288 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
21:06:34.300 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1799 more secs
21:06:34.300 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
21:06:35.300 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false
21:06:35.300 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for window 'null' local frame 'null' for 1798 more secs
21:06:35.301 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - waiting for condition for 1000 more ms
21:06:36.301 DEBUG [12] org.openqa.selenium.server.FrameGroupCommandQueueSet - got condition? : false

...等等。

我还尝试运行 SeleniumLibary 的演示 (http://code.google.com/p/robotframework-seleniumlibrary/wiki/Demo),结果相同。

为了确保问题出在 Robot 框架上,我创建了一个使用 Firefox 的 Java Selenium 测试 - 这很有效。

有没有人遇到同样的问题?有谁知道如何解决这一问题?非常感谢任何帮助。

我的测试脚本如下所示:

*** Settings ***

Resource    resource.txt


*** Test Cases ***

Hello World
    Open browser to http://www.google.de/

resources.txt:

*** Settings ***

Library SeleniumLibrary
#Library    Selenium2Library


*** Variables ***

${BROWSER}  firefox
#${BROWSER} googlechrome


*** Keywords ***

Open browser to ${URL}
    Open browser    ${URL}  ${BROWSER}

感谢和最好的问候, 帕特里克

【问题讨论】:

    标签: macos firefox selenium selenium-rc robotframework


    【解决方案1】:

    我发现问题出在我使用的 Selenium 服务器的 2.3 版本上。我的测试适用于旧版本 2.15 的服务器。

    【讨论】:

      猜你喜欢
      • 2018-01-13
      • 1970-01-01
      • 2012-02-19
      • 2014-01-17
      • 1970-01-01
      • 1970-01-01
      • 2021-10-03
      • 2019-10-26
      • 1970-01-01
      相关资源
      最近更新 更多