开发者

Capybara + Selenium

开发者 https://www.devze.com 2023-02-24 15:09 出处:网络
When I run my tests using Selenium, my one step fails and the page looks like this in the browser: Internal Server Error

When I run my tests using Selenium, my one step fails and the page looks like this in the browser:

Internal Server Error

can't convert nil into String
WEBrick/1.3.1 (Ruby/1.9.2/2010-08-18) at 127.0.0.1:50752

When I run it with culerity instead, I get the output:

    Broken pipe (Errno::EPIPE)
          /Users/yuval/.rvm/gems/ruby-开发者_开发技巧1.9.2-p0/gems/culerity-0.2.15/lib/culerity/remote_object_proxy.rb:47:in `write'
etc...

When I run it without a js driver, it doesn't fail at that point at all (instead, it fails at a point when js is used, which is why I'm trying to run it with a js driver).

Any ideas?


I just faced te same problem, but found a solution.

If you try to open your browser with "http://127.0.0.1:3000" in development mode, instead of "http://localhost:3000", you should face the same problem.

In my case the problem was caused, because in my View file I used "request.domain" that returns nil if request is given in IP-like format, i.e. "http://127.0.0.1:50752".

Therefore, if somewhere in your view of helper methods you have something like this

link_to "Click me", :host => subdomain + "." + request.domain + request.port_string

you can change it to using helper method, like that:

link_to "Click me", :host => with_host(subdomain)

And helper like following:

  def with_host(subdomain)
    if request.domain.present?
      subdomain + "." + request.domain + request.port_string
    end
  end

That's the easiest solution that worked for me. Perhaps, you have something similar.

0

精彩评论

暂无评论...
验证码 换一张
取 消