Selenium with ruby rails and webrat


#1

Hi,
I have set up selenium and webrat with cucumber and ruby rails in Cygwin
on Windows DOS machine. I have everything working expect that when I
‘rake’ features, selenium is not starting up any firefox browser.

I have attached my sample project for the same. When I do ‘rake
features’ I get the below error. It looks like the script itself is
getting executed and not being validated by selenium.

Unfortunately, I am not a ruby developer and naive wrt selenium.

==========================================================================
$ rake features
(in /cygdrive/c/work/comcast/workspace/cucumber-test-pro)
/usr/bin/ruby.exe -I
“/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.7/lib:lib” -S rcov --rails
–exclude osx/
“/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.7/bin/cucumber” – --format
pretty features/google_search.featu
Feature: When I am on google page, i should be
able to search any string

Scenario: Search a string in google #
features/google_search.feature:4
==> Waiting for Selenium RC server on port 4444… Ready!
Starting app server
Given I am on google page #
features/step_definitions/google_search_steps.rb:13
Connection refused - connect(2) (Errno::ECONNREFUSED)
/usr/lib/ruby/1.8/net/http.rb:560:in initialize' /usr/lib/ruby/1.8/net/http.rb:560:inopen’
/usr/lib/ruby/1.8/net/http.rb:560:in connect' /usr/lib/ruby/1.8/timeout.rb:62:intimeout’
/usr/lib/ruby/1.8/timeout.rb:93:in timeout' /usr/lib/ruby/1.8/net/http.rb:560:inconnect’
/usr/lib/ruby/1.8/net/http.rb:553:in do_start' /usr/lib/ruby/1.8/net/http.rb:542:instart’
/usr/lib/ruby/1.8/net/http.rb:1035:in request' /usr/lib/ruby/1.8/net/http.rb:845:inpost’
/usr/lib/ruby/1.8/timeout.rb:62:in timeout' /usr/lib/ruby/1.8/timeout.rb:93:intimeout’
(eval):2:in visit' ./features/step_definitions/google_search_steps.rb:2:in/^I am on
google page$/’
features/google_search.feature:5:in `Given I am on google page’
Then I should be able to search some string #
features/step_definitions/google_search_steps.rb:17

1 scenario (1 failed)
2 steps (1 failed, 1 skipped)
76.6% 2 file(s) 69 Lines 47 LOC
rake aborted!
Command failed with status (1): [/usr/bin/ruby.exe -I
"/usr/lib/ruby/gems/1…]

(See full trace by running task with --trace)


#2

Hurry, I got this solved. One of my colleague pointed out this forum
which solved my issue.

I modified webrat gem source code to fix this. However, I didnot try
webrat config option. I wanted to play with working selenium for some
time.

Forum :::::
http://formatinternet.wordpress.com/2009/04/27/cucumber-selenium-webrat-and-windows/

THanks!

Tamil R. wrote:

Hi,
I have set up selenium and webrat with cucumber and ruby rails in Cygwin
on Windows DOS machine. I have everything working expect that when I
‘rake’ features, selenium is not starting up any firefox browser.

I have attached my sample project for the same. When I do ‘rake
features’ I get the below error. It looks like the script itself is
getting executed and not being validated by selenium.

Unfortunately, I am not a ruby developer and naive wrt selenium.

==========================================================================
$ rake features
(in /cygdrive/c/work/comcast/workspace/cucumber-test-pro)
/usr/bin/ruby.exe -I
“/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.7/lib:lib” -S rcov --rails
–exclude osx/
“/usr/lib/ruby/gems/1.8/gems/cucumber-0.3.7/bin/cucumber” – --format
pretty features/google_search.featu
Feature: When I am on google page, i should be
able to search any string

Scenario: Search a string in google #
features/google_search.feature:4
==> Waiting for Selenium RC server on port 4444… Ready!
Starting app server
Given I am on google page #
features/step_definitions/google_search_steps.rb:13
Connection refused - connect(2) (Errno::ECONNREFUSED)
/usr/lib/ruby/1.8/net/http.rb:560:in initialize' /usr/lib/ruby/1.8/net/http.rb:560:inopen’
/usr/lib/ruby/1.8/net/http.rb:560:in connect' /usr/lib/ruby/1.8/timeout.rb:62:intimeout’
/usr/lib/ruby/1.8/timeout.rb:93:in timeout' /usr/lib/ruby/1.8/net/http.rb:560:inconnect’
/usr/lib/ruby/1.8/net/http.rb:553:in do_start' /usr/lib/ruby/1.8/net/http.rb:542:instart’
/usr/lib/ruby/1.8/net/http.rb:1035:in request' /usr/lib/ruby/1.8/net/http.rb:845:inpost’
/usr/lib/ruby/1.8/timeout.rb:62:in timeout' /usr/lib/ruby/1.8/timeout.rb:93:intimeout’
(eval):2:in visit' ./features/step_definitions/google_search_steps.rb:2:in/^I am on
google page$/’
features/google_search.feature:5:in `Given I am on google page’
Then I should be able to search some string #
features/step_definitions/google_search_steps.rb:17

1 scenario (1 failed)
2 steps (1 failed, 1 skipped)
76.6% 2 file(s) 69 Lines 47 LOC
rake aborted!
Command failed with status (1): [/usr/bin/ruby.exe -I
"/usr/lib/ruby/gems/1…]

(See full trace by running task with --trace)