seleniumwebdrivercucumberwatirwatir-webdriver

Cucumber disable proxy and use direct connection


I am trying to write a cucumber test which uses Watir Webdriver and selenium with the Headless gem. I get the error: Timeout::Error: Timeout::Error from /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rescue in rbuf_fill'

When trying to open a page on a hostname that is mapped to a local connection (custom hostname mapped to 127.0.0.1) which is then set up as a virtual server in Apache.

I have a default system proxy which needs to be avoided for this connection because it should not use the proxy for local connections. I have already added the ignore proxy host to my ubuntu configuration.

How can I tell my Watir firefox profile NOT to use a proxy and instead direct connection. Or, how can I tell the profile to ignore the proxy for the custom hostname?

Everywhere in the documentation just mentions setting up a proxy, not how to disable it or how to ignore hosts in it.

The code I have is:

require 'watir-webdriver'
require 'headless'

Headless.new.start
b = Watir::Browser.new
b.goto 'http://gi-local'

Which then times out on the goto.

I have also tried adding:

profile = Selenium::WebDriver::Firefox::Profile.new
profile['network.proxy.no_proxies_for']='localhost, 127.0.0.1, gi-local'
b = Watir::Browser.new :firefox, :profile => profile
b.goto 'http://gi-local'

But this still times out.


Solution

  • Solved. Needed to set all the proxy settings, not just the no_proxies part and also make sure to use numbers for ports instead of strings.