我有一些使用selenium的经验,并使用webdriver通过IDE和Java程序运行它。我现在正在尝试用selenium网格来实现这一点,将其与我们目前正在使用的竹子服务器联系起来。我已经下载了网格,然后通过演示。我已经启动了集线器和RC,但演示似乎启动了firefox,然后就坐在那里。
我的Java版本:
java -version
java version "1.7.0_25"
Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
Java HotSpot(TM) 64-Bit Server VM (build 23.25-b01, mixed mode)
我正在使用ant命令,因为在本机上安装了ant(Ubuntu 12.0.4)。
集线器:
ant launch-hub
Buildfile: /home/seleniumgridhub/SeleniumGrid/selenium-grid-1.0.8/build.xml
launch-hub:
[java] Jun 26, 2013 2:00:31 PM com.thoughtworks.selenium.grid.hub.HubRegistry gridConfiguration
[java] INFO: Loaded grid configuration:
[java] ---
[java] hub:
[java] environments:
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Windows
[java] -
[java] browser: "*firefox"
[java] name: Firefox on OS X
[java] -
[java] browser: "*firefox"
[java] name: Firefox on Linux
[java] -
[java] browser: "*iehta"
[java] name: IE on Windows
[java] -
[java] browser: "*safari"
[java] name: Safari on OS X
[java] -
[java] browser: "*firefox"
[java] name: "*firefox"
[java] -
[java] browser: "*firefox2"
[java] name: "*firefox2"
[java] -
[java] browser: "*firefox3"
[java] name: "*firefox3"
[java] -
[java] browser: "*chrome"
[java] name: "*chrome"
[java] -
[java] browser: "*iexplore"
[java] name: "*iexplore"
[java] -
[java] browser: "*iehta"
[java] name: "*iehta"
[java] -
[java] browser: "*safari"
[java] name: "*safari"
[java] -
[java] browser: "*opera"
[java] name: "*opera"
[java] -
[java] browser: "*googlechrome"
[java] name: "*googlechrome"
[java] -
[java] browser: "*firefoxproxy"
[java] name: "*firefoxproxy"
[java] -
[java] browser: "*pifirefox"
[java] name: "*pifirefox"
[java] -
[java] browser: "*iexploreproxy"
[java] name: "*iexploreproxy"
[java] -
[java] browser: "*piiexplore"
[java] name: "*piiexplore"
[java] -
[java] browser: "*safariproxy"
[java] name: "*safariproxy"
[java]
[java] 2013-06-26 14:00:31.999::INFO: Logging to STDERR via org.mortbay.log.StdErrLog
[java] 2013-06-26 14:00:32.053::INFO: jetty-6.0.x
[java] 2013-06-26 14:00:32.213::INFO: Started SocketConnector @ 0.0.0.0:4444
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.hub.management.RegistrationServlet process
[java] INFO: Registering new remote control...
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.hub.management.RegistrationServlet process
[java] INFO: Registered [RemoteControlProxy localhost:5555#false]
[java] Jun 26, 2013 2:01:50 PM com.thoughtworks.selenium.grid.hub.HubServlet forward
[java] INFO: Processing '1 => "*firefox", 2 => "http://images.google.com", 3 => "", cmd => "getNewBrowserSession"'
[java] Jun 26, 2013 2:01:50 PM com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlProvisioner reserve
[java] INFO: Reserved remote control[RemoteControlProxy localhost:5555#true]
[java] Jun 26, 2013 2:03:32 PM com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 26, 2013 2:06:32 PM com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 26, 2013 2:09:32 PM com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
[java] Jun 26, 2013 2:12:32 PM com.thoughtworks.selenium.grid.hub.remotecontrol.RemoteControlPoller garbageCollectRemoteControls
[java] INFO: Garbage collecting unavailable RCs and stale sessions...
RC:
ant launch-remote-control
Buildfile: /home/seleniumgridhub/SeleniumGrid/selenium-grid-1.0.8/build.xml
launch-remote-control:
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.remotecontrol.RegistrationRequest execute
[java] INFO: Registering to http://localhost:4444/registration-manager/register
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControl logStartingMessages
[java] INFO: Starting selenium server with options:[RegistrationInfo seleniumHubURL='http://localhost:4444', env='*firefox', host='localhost', port='5555']
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControl logStartingMessages
[java] INFO: hubPollerInterval: 30000 ms
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControl logStartingMessages
[java] INFO: -port
[java] Jun 26, 2013 2:01:09 PM com.thoughtworks.selenium.grid.remotecontrol.SelfRegisteringRemoteControl logStartingMessages
[java] INFO: 5555
[java] 14:01:10.063 INFO - Java: Oracle Corporation 23.25-b01
[java] 14:01:10.065 INFO - OS: Linux 3.5.0-34-generic amd64
[java] 14:01:10.095 INFO - v2.0 [a2], with Core v2.0 [a2]
[java] 14:01:10.267 INFO - RemoteWebDriver instances should connect to: http://10.211.55.22:5555/wd/hub
[java] 14:01:10.268 INFO - Version Jetty/5.1.x
[java] 14:01:10.269 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
[java] 14:01:10.274 INFO - Started HttpContext[/selenium-server,/selenium-server]
[java] 14:01:10.274 INFO - Started HttpContext[/,/]
[java] 14:01:10.287 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@54c8d4b4
[java] 14:01:10.287 INFO - Started HttpContext[/wd,/wd]
[java] 14:01:10.289 INFO - Started SocketListener on 0.0.0.0:5555
[java] 14:01:10.289 INFO - Started org.openqa.jetty.jetty.Server@1a10540f
[java] 14:01:39.993 INFO - Checking connection to hub...
[java] 14:01:39.994 INFO - Ping Hub at http://localhost:4444/heartbeat?host=localhost&port=5555
[java] 14:01:50.960 INFO - Checking Resource aliases
[java] 14:01:50.964 INFO - Command request: getNewBrowserSession[*firefox, http://images.google.com, ] on session null
[java] 14:01:50.966 INFO - creating new remote session
[java] 14:01:51.092 INFO - Allocated session d0dd7e782dd34fa287bdff20a4e48cd9 for http://images.google.com, launching...
[java] 14:01:51.171 INFO - Preparing Firefox profile...
[java] 14:01:54.266 INFO - Launching Firefox...
[java] 14:02:10.048 INFO - Checking connection to hub...
[java] 14:02:10.048 INFO - Ping Hub at http://localhost:4444/heartbeat?host=localhost&port=5555
答案 0 :(得分:2)
如果您使用的是selenium webdriver,则必须使用Selenium Grid 2
从selenium server下载here(截至本回答第33版)
然后通过运行此命令启动集线器
java -jar selenium-server-standalone-2.33.0.jar -role hub
和一个节点(运行BOTH selenium RC和webdriver脚本的能力) -
java -jar selenium-server-standalone-2.33.0.jar -role node -hub http://localhost:4444/grid/register
希望你能从这里弄明白。