我对使用机器人框架进行测试自动化很感兴趣 .
我创建了一个使用的测试脚本
-
Robot Framework v2.6.3(由Python v2.6.1提供支持)
-
SeleniumLibrary for Robot v2.8
-
Selenium Server v2.3
我的操作系统是Mac OS X 10.6.8(Snow Leopard) .
我的测试使用Chrome驱动程序在Google Chrome上正常运行 . 但是,Chrome不支持抓取网页截图,这是我不能没有的功能 .
所以我尝试在Firefox v10.0.2中运行测试,它支持页面截图,但这不起作用 .
当我开始测试时,会弹出一个Firefox窗口,显示一个空白页面,直到我杀死pybot才会发生任何事情 .
我尝试使用Robot启动Selenium Server并从命令行自己启动Selenium服务器,但无济于事 .
我还尝试为服务器设置一个干净的Firefox配置文件,这也没有用 .
我还尝试了更新的Selenium2Library for Robot Framework(v0.5.2),在Chrome中运行良好,但在Firefox中运行不正常 .
我还尝试了一个更简单的“hello world”类型测试,基本上只是打开www.google.com - 仍然没有运气的Firefox .
在所有这些情况下,行为是相同的:
-
清空Firefox窗口打开
-
Robot框架打印测试用例的名称,然后停止
-
Selenium服务器说"Launching 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}
谢谢,最诚挚的问候,Patrick
1 回答
我发现问题是我使用的Selenium服务器的2.3版本 . 我的测试适用于服务器的旧版本2.15 .