Ruby 网关超时:无法使用Capybara/RSpec代码在Ubuntu默认Firefox浏览器上打开网页

Ruby 网关超时:无法使用Capybara/RSpec代码在Ubuntu默认Firefox浏览器上打开网页,ruby,rspec,proxy,capybara,Ruby,Rspec,Proxy,Capybara,我对Web开发和测试是新手。如果您能回答我下面描述的测试问题,我将不胜感激 任务是在Ubuntu12.04客户端操作系统上使用Firefox浏览器打开网页,并测试特定的输入/响应输出元素。测试脚本代码使用Capybara gem和RSpec gem 我看到:使用bundle exec rspec page_test.rb,我看到网关超时504错误 代码:这是为此目的编写的代码。可以使用Firefox浏览器从主机打开远程URL。主机在bash shell env上设置了http_代理服务器设置 错

我对Web开发和测试是新手。如果您能回答我下面描述的测试问题,我将不胜感激

任务是在Ubuntu12.04客户端操作系统上使用Firefox浏览器打开网页,并测试特定的输入/响应输出元素。测试脚本代码使用Capybara gem和RSpec gem

我看到:使用
bundle exec rspec page_test.rb
,我看到网关超时504错误

代码:这是为此目的编写的代码。可以使用Firefox浏览器从主机打开远程URL。主机在bash shell env上设置了http_代理服务器设置

错误: 签到程序让我签到

失败/错误:访问“/”

Selenium:WebDriver::Error::WebDriverError:意外响应, code=504,content type=“text/html”

通知:网关超时

代码: 请指出错误或建议访问远程URL服务器和测试元素的其他方法

非常感谢!
Mihyr

我使用的是ubuntu 14.04,我不得不将firefox从47降级到28,我把它放在我的gem文件中,而不是使用最新版本

gem'selenium webdriver',“2.48.0”


此链接帮助我降级:

这是我的GEMFILE:source“gem”rspec“gem”mime类型、“2.6.2”gem“capybara”gem“selenium webdriver”,rspec版本为3.3.2,Ruby版本为1.9.3p0。错误显示在第33行,即“visit”/“代码行。如果有人能告诉我错误的基本原因和可能的修复方法,我将不胜感激。除了投票,我还可以送巧克力或餐馆礼品卡,以获得富有成效的帮助。这是我的第一篇文章。
require 'rspec'

require 'capybara'

require 'capybara/dsl'

require 'capybara/rspec'

require 'selenium-webdriver'



Capybara.run_server = false

Capybara.current_driver = :selenium

Capybara.register_driver :selenium do |app|

    profile = Selenium::WebDriver::Firefox::Profile.new

    profile["network.proxy.type"] = 1

    profile["network.proxy.http"] = "http://proxy.esl.corpserver.com"

    profile["network.proxy.http_port"] = 8888


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

end


Capybara.app_host = 'http://192.168.205.69'

session = Capybara::Session.new(:selenium)

describe "the signin process", :type => :feature, :js => true do



    it "signs me in" do
        include Capybara::DSL

        visit '/'

        within("//form[@id='session']") do
            fill_in 'User Name', :with => 'admin'
            fill_in 'Password', :with => 'password'
        end

        click_button 'Sign in'

        fill_in 'input', :with => 'show server status'

        check 'json'
        check 'cli_show'
        click_button 'post'
        expect(find('#response_output')).to have_content('cli_show')

    end

end