Ruby 访问Ubuntu12.04上的登录页面时出现Poltergeist超时错误
给定Ruby 访问Ubuntu12.04上的登录页面时出现Poltergeist超时错误,ruby,ubuntu-12.04,phantomjs,poltergeist,Ruby,Ubuntu 12.04,Phantomjs,Poltergeist,给定Ubuntu12.04,Poltergeist 0.7.0,PhantomJS 1.6.5和一个规范(仅使用普通的老式capybara webkit或selenium),我在尝试访问页面时会出现以下错误: Capybara::Poltergeist::TimeoutError: Timed out waiting for response to { "args":["http://127.0.0.1:41706/login",{}], "name":"visit"
Ubuntu12.04
,Poltergeist 0.7.0
,PhantomJS 1.6.5
和一个规范(仅使用普通的老式capybara webkit
或selenium
),我在尝试访问页面时会出现以下错误:
Capybara::Poltergeist::TimeoutError:
Timed out waiting for response to {
"args":["http://127.0.0.1:41706/login",{}],
"name":"visit"
}
同样的命令也在mac10.7上本地传递
有什么想法吗?你的页面上有谷歌分析吗?
我发现用类似
的东西包装分析代码可以阻止页面超时。在Capybara.rb文件中使用此选项解决了我的问题:
Capybara.javascript_driver = :poltergeist
options = { js_errors: false, timeout: 180, phantomjs_logger: StringIO.new, logger: nil, phantomjs_options: ['--load-images=no', '--ignore-ssl-errors=yes'] }
Capybara.register_driver(:poltergeist) do |app|
Capybara::Poltergeist::Driver.new app, options
end
听起来好像超时了,因为您正试图访问计算机上未打开的端口。你检查过防火墙设置吗?您好@FilmJ,这个端口没有限制,在正常的rspec/cucumber/capbyara规范中可以正常工作,但在poltergeist中失败。我只是放弃了poltergiest,决定用rspec/capybara webkit跑步。谢谢你的回答。@kikuchiyo你解决过这个问题吗?@austinfomborston,不,我很久以前就放弃了恶作剧。太棒了!是的,我想是的。我今天就来试试:)再次感谢你的回答。我检查了一下,我们确实省略了测试环境中的谷歌分析代码。