2013-08-02 80 views
0

下面的selenium-client(1.2.18)腳本在我們的測試環境中超時。該腳本在本地工作,但不在我們的測試環境中。我只包含重現超時所需的最低限度代碼(這就是爲什麼我直接執行http.post)。Selenium Grid Timeout

在測試環境中,我查看了firefox sessionstore.js,發現瀏覽器正在訪問該站點,但似乎它從未回傳給該節點。

編輯:捲曲'www.google.com'從測試環境中工作。

require 'selenium/client' 
require 'net/http' 

@browser = Selenium::Client::Driver.new(:host => 'localhost', 
              :port => 4445, 
              :browser => '*firefox', 
              :url => 'http://www.google.com/', 
              :timeout_in_second => 60) 
@browser.start_new_browser_session 
session_id = @browser.session_id 
p "SESSION ID: #{session_id}" 

http = Net::HTTP.new('localhost', 4445) 

begin 
    response = http.post('/selenium-server/driver/',"cmd=open&1=landing/summer/index.html&2=true&sessionId=#{session_id}") 
    p "RESPONSE: #{response}" 
ensure 
    p "CLOSING SESSION..." 
    @browser.close_current_browser_session 
end 

電網樞紐開始下列要求:

selenium-server-standalone-2.25.0.jar -port 4445 -timeout 180 -singleWindow -role hub -browserTimeout 300 -newSessionMaxWaitTimeInSeconds 300 -newSessionWaitTimeout 300 -firefoxProfileTemplate /var/tmp/selenium-grid-start-stop/releases/20130802031034/firefox_profile -trustAllSSLCertificates 

節點開始執行以下操作:

selenium-server-standalone-2.25.0.jar -role node -port 6666 -hub http://localhost:4445/grid/register -maxSession 1 -firefoxProfileTemplate /var/tmp/selenium-grid-start-stop/releases/20130802031034/firefox_profile -browser browserName=*firefox,seleniumProtocol=Selenium 

並運行測試腳本...

$ruby test2.rb 
"SESSION ID: 18609e43667a4aa094fe81ef30551b84" 
"CLOSING SESSION..." 
/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in  rbuf_fill': Timeout::Error (Timeout::Error) 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:134:in  `rbuf_fill' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:116:in `readuntil' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:126:in `readline' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:2219:in `read_status_line' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:2208:in `read_new' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1191:in `transport_request' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1177:in `request' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1170:in `block in request' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:627:in `start' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:1168:in `request' 
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/http.rb:978:in `post' 

任何人都見過這種超時?該網站(谷歌)顯然是起來的。也許在測試環境中配置錯誤?

回答

0

我找到了解決方案。我們在我們的測試環境中從10 - > 17意外升級了Firefox。

我們的網格節點提供的Firefox prefs.js無法在Firefox 17中使用。這使得瀏覽器可以啓動併成功連接到網站,但無法(無論出於何種原因)迴應節點。

解決方案是爲FF 17提供更新的prefs.js。我們通過運行測試而無需提供自己的偏好來獲得此項目。這迫使Firefox創建我們複製和編輯的默認首選項文件。