ruby-on-rails – Capybara Selenium

When I use Selenium to run my test, my step fails and the page is displayed as follows 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, 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 am When running it without a js driver, it doesn’t fail at all (instead, it fails when using js, which is why I tried to run it with a js driver).

Any ideas? ?

I just encountered the same problem, but I found a solution.

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

In my case, it caused the problem because in my View file, I used “request.domain”. If the request is provided in an IP-like format, it will return nil, which is “http://127.0. 0.1:50752”.

So if you have something like this somewhere in the helper method view

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

You can change it to use the helper method as follows:

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

And the helpers are as follows:

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

This is the best solution for me. Maybe , You have something similar.

When I use Selenium to run my test, my step fails and the page is displayed as follows 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, I get the output:

Broke n 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 the js driver, it does not fail at all (instead, it fails when using js, which is why I Trying to run it with js driver).

Any ideas?

I just encountered the same problem, but found a solution.

If you try to use in development mode Open the browser with “http://127.0.0.1:3000” instead of “http://localhost:3000”, you should encounter the same problem.

In my case, it caused the problem, Because in my View file, I used “request.domain”, if the request is provided in an IP-like format, it will return nil, which is “http://127.0.0.1:50752”.

So if you have something like this somewhere in the helper method view

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

You can change it to use the helper method as follows:

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

The helpers are as follows:

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

This is the most suitable solution for me. Maybe, you have something similar.

< /p>

Leave a Comment

Your email address will not be published.