ArgumentError:无法解释为DNS名称:n capybara

时间:2018-06-25 10:59:19

标签: ruby-on-rails capybara selenium-chromedriver

大家好,谁能帮助我解决问题

“ ArgumentError:无法解释为DNS名称:nil”

在Rails 4中进行水豚硒整合测试时出现错误 这里我使用的是jruby-1.7.9,JRuby中的ruby版本是2.0.0p195 当时我曾经使用过Ruby版本1.9.7 '无法连接到Chrome驱动程序错误' 在不使用JRuby的纯红宝石中,其集成测试正在运行。但是我的应用程序在JRuby中。我正在使用ubuntu平台。 所以任何人对此都有任何解决方案。我该怎么办才能解决这个问题?

这里我要添加异常回溯

[“ / home / sidharthan / .rbenv / versions / jruby-1.7.9 / lib / ruby​​ / 2.0 / resolv.rb:1181:in create'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:1027:in generate_candidates'”,“ / home / sidharthan /。 rbenv / versions / jruby-1.7.9 / lib / ruby​​ / 2.0 / resolv.rb:1052:in resolv'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:518:in each_resource'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib /ruby/2.0/resolv.rb:411:in each_address'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:120:in each_address'“,” org / jruby / RubyArray.java:1613:in each'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:119:in each_address'“,” /home/sidharthan/.rbenv /versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:97:in getaddress'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/resolv.rb:48:in getaddress'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ ruby / 1.9 / resolv-replace.rb:10:in getaddress'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/1.9/resolv-replace.rb:22:in中的initialize'“,” org / jruby / RubyIO.java:1178:in open'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:882:in connect'“,” org / jruby / ext / timeout / Timeout.java:144:in timeout'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:881:in connect'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:866:in do_start'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/2.0/net/http.rb:855:in开始“”,“ / home / sidharthan / .rbenv / versions / jruby-1.7.9 / lib / ruby​​ / 2.0 / net / http.rb:582:在start'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/server.rb:81:in中响应?” ,“ / home / sidharthan / .rbenv / versions / jruby-1.7.9 / lib / ruby​​ / gems / shared / gems / capybara-2.9.1 / lib / capybara / server.rb:97:in boot'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/session.rb:72:in初始化'“,” / home / sidhar比/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara.rb:324:in current_session'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/dsl.rb:47:in page'“,” / home /sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara/dsl.rb:52:in visit'", "/media/sidharthan/NewVolume/sidharthan_fooddev/foodapp/webapp/food/test/test_helper.rb:115:in IntegrationTest'“, “ /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/capybara-2.9.1/lib/capybara.rb:67:in configure'", "/media/sidharthan/NewVolume/sidharthan_fooddev/foodapp/webapp/food/test/test_helper.rb:102:in IntegrationTest'” ,“ org / jruby / RubyBasicObject.java:1565:in instance_exec'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:446:in make_lambda'”,“ org / jruby / RubyProc.java:271:in call'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:192:in simple'”,“ org / jruby / RubyProc。 java:271:in call'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in call'“,” org / jruby / RubyArray.java:1613:in each'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:504:in call'“,” /home/sidharthan/.rbenv/versions/jruby-1.7。 9 / lib / ruby​​ / gems / shared / gems / activesupport-4.2.6 / lib / active_support / callbacks.rb:92:in __run_callbacks__'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/callbacks.rb:782:in _ run_setup_callbacks'“,” /home/sidharthan/.rbenv/versions/jruby -1.7.9 / lib / ruby​​ / gems / shared / gems / activesupport-4.2.6 / lib / active_support / callbacks.rb:81:in run_callbacks'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/activesupport-4.2.6/lib/active_support/testing/setup_and_teardown.rb:41:in before_setup'“,” /home/sidharthan/.rbenv/版本/jruby-1.7.9/lib/ruby/gems/shared/gems/activerecord-4.2.6/lib/active_record/fi xtures.rb:827:在before_setup'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:105:in中运行“”,“ /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib /minitest/test.rb:204:in capture_exceptions'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:104:in run'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9。 1 / lib / minitest / test.rb:255:in time_it'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:103:in run'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest -5.9.1 / lib / minitest.rb:348:in on_signal'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest/test.rb:275:in with_info_handler'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/ minitest-5.9.1 / lib / minitest / test.rb:102:在run'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:799:in run_one_method'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared中/gems/minitest-5.9.1/lib/minitest.rb:322:in run_one_method'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:310:in run'“,” org / jruby / RubyArray.java:1613:in each'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:309:in run'“,” /主页/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:348:in on_signal'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:335:in with_info_handler'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:308:in run'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:158:in __ run'“, “ org / jruby / Ruby Array.java:2409:in map'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:158:in __ run'“,” /home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib /minitest.rb:135:在run'", "/home/sidharthan/.rbenv/versions/jruby-1.7.9/lib/ruby/gems/shared/gems/minitest-5.9.1/lib/minitest.rb:62:in自动运行'“]

预先感谢

1 个答案:

答案 0 :(得分:0)

从堆栈跟踪中您可以看到它在https://github.com/teamcapybara/capybara/blob/2.9.1/lib/capybara/server.rb#L81内出错-Capybara正在等待要测试的应用程序启动。  这可能意味着您未正确设置Capybara.server_hostCapybara.server_port。如果没有运行的实际代码来生成stacktrace,就很难说。

您可能还想更新到最新的Capybara 2.x版本-2.9.1确实很旧。