Ricardo Nacif
Ricardo Nacif

Reputation: 508

Selenium timeout when running Appium test on Sauce Labs

I'm trying to run my ruby test cases on Appium using Sauce Labs cloud service. Here are my capabilities:

  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"

The command bellow is giving a timeout because Sauce Labs is taking more than 60 seconds to create a VM and start Appium:

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

So I had to find a way of changing the timeout, I found using that:

    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)

That worked fine, BUT when I try to run it inside my company's network, I can see the test starting at Sauce Labs, but I get the following error before iOS Simulator is ready:

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> 

I have already contacted Sauce Labs support, but they couldn't find a solution to that. What might be wrong with the network?

Upvotes: 0

Views: 1726

Answers (1)

jon_two
jon_two

Reputation: 1238

Sounds like it is an issue with your company network. 504 is usually due to a timeout within one of the proxies in your connection. See this question.

Upvotes: 1

Related Questions