我尝试使用Sauce Labs云服务在Appium上运行我的ruby测试用例。以下是我的能力:
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"
下面的命令正在暂停,因为Sauce Labs花了60多秒来创建一个VM并启动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)
这很好用,但是当我尝试在我公司的网络中运行它时,我可以看到测试从Sauce Labs开始,但我在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的支持,但他们无法找到解决方案。网络出了什么问题?