Hi,all
I am trying to test web application using the sample code:
ruby 代码
- require "selenium"
- require "test/unit"
-
- class NewTest < Test::Unit::TestCase
- def setup
- @verification_errors = []
- if $selenium
- @selenium = $selenium
- else
- @selenium = Selenium::SeleneseInterpreter.new("localhost", 4444, "*firefox", "http://localhost:4444", 10000);
- @selenium.start
- end
- @selenium.set_context("test_new", "info")
- end
-
- def teardown
- @selenium.stop unless $selenium
- assert_equal [], @verification_errors
- end
-
- def test_new
- @selenium.open "/cn/articles/domain-web-testing"
- @selenium.click "//a[contains(@href, '/cn/')]"
- @selenium.wait_for_page_to_load "30000"
- end
- end
When executing, I got the following error message:
- Exception: Bad file descriptor - connect(2)
- D:/ruby/lib/ruby/1.8/net/http.rb:560:in `initialize'
- D:/ruby/lib/ruby/1.8/net/http.rb:560:in `open'
- D:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'
- D:/ruby/lib/ruby/1.8/timeout.rb:48:in `timeout'
- D:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
- D:/ruby/lib/ruby/1.8/net/http.rb:560:in `connect'
- D:/ruby/lib/ruby/1.8/net/http.rb:553:in `do_start'
- D:/ruby/lib/ruby/1.8/net/http.rb:542:in `start'
- D:/ruby/lib/ruby/1.8/net/http.rb:1032:in `request'
- D:/ruby/lib/ruby/1.8/net/http.rb:769:in `get'
- E:\ruby\workspace\dcrm2/test\selenium/selenium.rb:159:in `do_command'
- D:/ruby/lib/ruby/1.8/timeout.rb:56:in `timeout'
- D:/ruby/lib/ruby/1.8/timeout.rb:76:in `timeout'
- E:\ruby\workspace\dcrm2/test\selenium/selenium.rb:148:in `do_command'
- E:\ruby\workspace\dcrm2/test\selenium/selenium.rb:143:in `stop'
- E:\ruby\workspace\dcrm2/test/selenium/new_test.rb:17:in `teardown'
- D:/ruby/lib/ruby/1.8/test/unit/testcase.rb:79:in `run'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:34:in `run'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `each'
- D:/ruby/lib/ruby/1.8/test/unit/testsuite.rb:33:in `run'
- D:/ruby/lib/ruby/1.8/test/unit/ui/testrunnermediator.rb:46:in `run_suite'
- D:/Program Files/RadRails/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:107:in `start_mediator'
- D:/Program Files/RadRails/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:52:in `start'
- D:/Program Files/RadRails/plugins/org.rubypeople.rdt.testunit_0.8.0.604272100PRD/ruby/RemoteTestRunner.rb:272
Any idea? Thanks beforehand for your help.
I am running ruby 1.8.5 (i386-mswin32) on Windows XP.