2015-01-20 95 views
0

我想使用Sauce Labs雲服務在Appium上運行我的ruby測試用例。這裏是我的能力:在Sauce Labs上運行Appium測試時Selenium超時

caps = Selenium::WebDriver::Remote::Capabilities.iphone 
    caps['browserName'] = 'Safari' 
    caps['platformVersion'] = '7.1' 
    caps['platformName'] = 'iOS' 
    caps['deviceName'] = 'iPhone Simulator' 
    caps[:name] = "iOS testing with Appium" 
    caps[:autoAcceptAlerts] = true 
    caps["tunnel-identifier"] = sauce_tunnel_name 
    caps[:trustAllSSLCertificates] = true 
    caps[:safariIgnoreFraudWarning] = true 
    server_url = "http://#{ENV['SAUCE_USER']}:#{ENV['SAUCE_KEY']}@ondemand.saucelabs.com:80/wd/hub" 

命令波紋管是給超時,因爲醬實驗室正在超過60秒,以創建一個虛擬機,並開始Appium:

Watir::Browser.new(
     :remote, 
     :url => server_url, 
     :desired_capabilities => caps) 

所以我必須找到一種方法改變超時,我發現使用:

http_client = Selenium::WebDriver::Remote::Http::Persistent.new 
    http_client.timeout = 300 # 
    client = Selenium::WebDriver.for(:remote, :desired_capabilities => caps, :url => server_url, :http_client => http_client) 
    Watir::Browser.new(client) 

這工作得很好,但是當我嘗試運行它在我的公司的內部網絡,我可以看到測試開始在醬實驗室,但我得到了FOLL在iOS模擬器準備就緒之前發生錯誤:

Selenium::WebDriver::Error::WebDriverError: 
unexpected response, code=504, content-type="text/html" 
<HEAD><TITLE>Connection Timed Out</TITLE></HEAD> 
<BODY BGCOLOR="white" FGCOLOR="black"><H1>Connection Timed Out</H1><HR> 
<FONT FACE="Helvetica,Arial"><B> 
Description: Connection Timed Out</B></FONT> 
<HR> 
<!-- default "Connection Timed Out" response (504) --> 
</BODY> 

我已經聯繫Sauce Labs支持,但他們找不到解決方案。網絡可能有什麼問題?

回答

1

聽起來像這是你的公司網絡的問題。 504通常是由於連接中某個代理髮生超時。請參閱this問題。

相關問題