能否在capybara中使用HTTP代理?

3
Capybara的API似乎不支持配置HTTP代理。有没有办法在其中使用代理?
背景:我正在使用capybara和cucumber测试rails应用程序,并将akephalos作为javascript驱动程序。页面上有一个
1个回答

5

我不知道Akephalos,但使用Selenium/Firefox来实现这一点是完全可能的:

  Capybara.register_driver :selenium do |app|
    profile = Selenium::WebDriver::Firefox::Profile.new

    profile["network.proxy.type"] = 1 # manual proxy config
    profile["network.proxy.http"] = "http://example.com"
    profile["network.proxy.http_port"] = 80

    Capybara::Selenium::Driver.new(app, :profile => profile)
  end

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接