Capybara-webkit尝试打开example.com [英] Capybara-webkit tries to open example.com

查看:68
本文介绍了Capybara-webkit尝试打开example.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用水豚,水豚Webkit,水豚截屏以及黄瓜。 (Ruby 1.9.3,Rails 3.1.3)和 Capybara.javascript_driver =:webkit 也设置为env.rb

I'm using capybara, capybara-webkit, capybara-screenshot together with cucumber. (Ruby 1.9.3, Rails 3.1.3) and Capybara.javascript_driver = :webkit is also set env.rb

不幸的是,由于某些原因,使用 @javascript 运行黄瓜规格将永远不会成功,并且错误截图仅捕获example.com。

Unfortunately running a cucumber spec with @javascript will never succeed for some reason and the error screenshots just capture example.com.

我实际尝试打开的URL是使用我的其中一个模型的rails路由器结果生成的,例如使用访问products_url

The URL which I actually try to open is generated with a rails router result for one of my models e.g. with visit products_url

那么如何避免它最终查询example.com?

So how can I avoid that it ends up querying example.com?

非常欢迎任何输入。

仅仅是因为评论搞乱了-这是我找到的解决方案:

Just because the comment is messed up - here's what I found was the solution:

Capybara.run_server = true
Capybara.server_port = 7787
Before '@javascript' do
  Capybara.app_host = "http://127.0.0.1:#{Capybara.server_port}"
end


推荐答案

尝试使用访问products_path 。他们不建议在自述文件的 Gotchas部分中使用绝对URL。

Try using visit products_path instead. They do not recommend using absolute URLs in "Gotchas" section of README.

这篇关于Capybara-webkit尝试打开example.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆