Capybara-webkit 引发 Capybara::Driver::Webkit::WebkitInvalidResponseError
我在 rspec 中从 webkit 驱动程序收到以下消息:
Capybara::Driver::Webkit::WebkitInvalidResponseError:
Unable to load URL: http://127.0.0.1:44923/posts
几天前它起作用了。问题出在 save_page
方法上。 可能出什么问题了?
I got following message from webkit driver in my rspec:
Capybara::Driver::Webkit::WebkitInvalidResponseError:
Unable to load URL: http://127.0.0.1:44923/posts
Few days ago it worked. The problem is with save_page
method.
What could be wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
当我的页面出现错误时,我也收到过类似的错误消息。您应该通过在测试模式 (
rails s -e test
) 下启动服务器并自行访问该页面来手动检查是否存在这种情况。I've had similar error messages when my page was raising an error. You should check manually that this is not the case by starting a server in testing mode (
rails s -e test
) and accessing the page yourself.检查您的应用程序中是否存在任何其他可能阻止 Capybara 加载页面的错误。上次我得到它时,我意识到有一个 500 错误页面,这就是 Capybara 引发 Capybara::Driver::Webkit::WebkitInvalidResponseError 的原因。
Check if you don't have any other error in your application that could prevent Capybara from loading the page. Last time I got it, I realized that there was a 500 error page and that was why Capybara raised Capybara::Driver::Webkit::WebkitInvalidResponseError.
尝试从您的包中完全删除 gem
thin
。即使它仅位于
:development
或:product
组中!Try removing gem
thin
from your bundle completely.Even if it is in
:development
or:production
group only!在您的
test.rb
中:设置
config.action_dispatch.show_exceptions = true
,您将看到导致
WebkitInvalidResponseError
的异常In your
test.rb
:set
config.action_dispatch.show_exceptions = true
and you will see the exception that caused the
WebkitInvalidResponseError