我对使用机器人框架进行测试自动化感兴趣。在Mac OS X上使用Robot Framework在Firefox中运行Selenium测试导致挂起Selenium服务器/空白浏览器窗口
我创建了一个使用
- 机器人框架V2.6.3(搭载的Python V2.6.1)
- SeleniumLibrary机器人V2.8测试脚本
- Selenium服务器V2.3
我的操作系统是Mac OS X 10.6.8(Snow Leopard)。
我的测试使用Chrome驱动程序在Google Chrome上运行良好。但是,Chrome不支持浏览页面截图,这是我不能没有的功能。
因此,我尝试在Firefox v10.0.2中运行测试,该测试支持页面截图,但这不起作用。
当我开始测试时,弹出一个Firefox窗口,显示一个空白页面,直到我杀死pybot时才会发生任何事情。
我试着用Robot启动Selenium服务器并且自己从命令行启动Selenium服务器,但都无济于事。
我也尝试设置一个干净的Firefox配置文件供服务器使用,这也没有帮助。
我也尝试了更新的机器人框架Selenium2Library(v0.5.2),在Chrome中工作正常,但在Firefox中无法正常工作。
我也尝试了一个更简单的“hello world”类型测试,基本上只是打开www.google.com - 仍然没有运气与Firefox。
在所有这些情况下,行为是相同的:
- 空Firefox窗口打开
- 机器人框架打印测试案例的名称,然后停止
- 硒服务器写着“启动Firefox ”,然后停止
硒服务器的日志文件显示了这样一个无休止的名单:
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}
感谢和问候, 帕特里克