Cucumber禁用代理并使用直接连接

问题描述 投票:0回答:2

我正在尝试编写一个黄瓜测试,该测试使用 Watir Webdriver 和 selenium 以及 Headless gem。 我收到错误: 超时::错误: 超时::错误 来自 /var/lib/jenkins/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/net/protocol.rb:140:in `rbuf_fill 中的救援'

当尝试打开映射到本地连接的主机名(映射到 127.0.0.1 的自定义主机名)上的页面时,该主机名随后在 Apache 中设置为虚拟服务器。

我有一个默认的系统代理,需要避免此连接,因为它不应该使用代理进行本地连接。我已经将忽略代理主机添加到我的 ubuntu 配置中。

如何告诉我的 Watir firefox 配置文件不要使用代理,而是直接连接。或者,我如何告诉配置文件忽略自定义主机名的代理?

文档中的所有地方都只提到设置代理,而不是如何禁用它或如何忽略其中的主机。

我的代码是:

require 'watir-webdriver'
require 'headless'

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

然后在 goto 上超时。

我也尝试过添加:

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'

但这仍然超时。

selenium webdriver cucumber watir watir-webdriver
2个回答
0
投票

解决了。需要设置所有代理设置,而不仅仅是 no_proxies 部分,并确保使用数字作为端口而不是字符串。


0
投票

在Ubuntu中 echo $http_proxy 检查代理地址。如果不为空,请将其设置为空。 类型:http_proxy=

© www.soinside.com 2019 - 2024. All rights reserved.