2014-05-20 50 views
1

我正在嘗試selenium虛擬機上的網格與vagrant。我所做的是我followd從這裏https://code.google.com/p/selenium/wiki/Grid2步驟,我定義了一個集線器sudo java -jar selenium-server-standalone-2.41.0.jar -role hub問題在虛擬機上運行硒網格

,並在同一VM sudo java -jar selenium-server-standalone-2.41.0.jar -role node -hub http://10.0.2.2:4444/grid/register其中http://10.0.2.2:4444/是VM的私有IP,以便與中心註冊節點本地定義的節點。

我的問題是,當我想運行一個Selenium測試在Python裏我得到這個錯誤:

Exception: <html> 
<head> 
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/> 
<title>Error 500 org.openqa.grid.common.exception.GridException: Error forwarding the new session The server returned an error : Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser</title> 
</head> 
<body> 
<h2>HTTP ERROR: 500</h2> 
<p>Problem accessing /selenium-server/driver/. Reason: 
<pre> org.openqa.grid.common.exception.GridException: Error forwarding the new session The server returned an error : Failed to start new browser session: org.openqa.selenium.server.RemoteCommandException: Error while launching browser</pre></p> 
<hr /><i><small>Powered by Jetty://</small></i> 

而且還當我從瀏覽器中運行它:http://10.0.2.2:4444/selenium-server/driver/?cmd=getNewBrowserSession&1=*firefox&2=http://www.google.com​

我得到這個錯誤:Error forwarding the new session Empty pool of VM for setup Capabilities

我認爲節點無法註冊到集線器,我也將其更改爲公共IP,所以我使用了類似http://X.X.X.106:4444/grid/register的東西。但我仍然看到錯誤。但是當我在VM之外嘗試它時,它工作正常!任何想法如何修復虛擬機上的硒網格。

回答

0

我試圖做同樣的(網格+虛擬機),但我沒有成功。 問題在於主機和VM機器之間的連接。 我認爲你應該配置VirtualBox上的網絡連接爲橋接: Bridged networking