我有一些使用selenium的經驗,並使用webdriver通過IDE和Java程序運行它。我現在正在嘗試使用硒網格來完成此操作,以將其與我們當前使用的竹服務器綁定。我已經下載了網格,並通過演示。我已經發布了這個集線器和一個RC,但是這個演示似乎發佈了firefox,然後就坐在那裏。Selenium Grid示例未正確啓動
我的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)
我使用的是螞蟻安裝這臺機器(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 [email protected]
[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 [email protected]
[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
發生錯誤/不兼容的硒庫版本時發生在我身上。首先,檢查你想要配置的硒網格的版本:1或2.網上有很多演示參考v.1,它與v.2有很大的不同。 (我想你正在嘗試使用v.2)我使用的是selenium grid 2('selenium-java'和'selenium-server-standalone',都是2.32.0),並且它可以在最新版本的Firefox中正常工作。 –