1
我們有一個虛擬的Windows 7映像,我們的CI在IE10上運行我們的功能測試。功能測試使用Cucumber + Watir-Webdriver以Ruby編寫。Webdriver在IE10/Win7上導致「SocketError:getaddrinfo:沒有這樣的主機」
大多數的正常工作時間,但現在每然後每個測試開始與下面的異常失敗:
EXCEPTION: SocketError: getaddrinfo: No such host is known.
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/platform.rb:169:in `getaddrinfo'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/platform.rb:169:in `localhost'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/remote/bridge.rb:48:in `block in initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/remote/bridge.rb:48:in `delete'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/remote/bridge.rb:48:in `initialize'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/driver.rb:35:in `new'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver/common/driver.rb:35:in `for'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.34.0/lib/selenium/webdriver.rb:67:in `for'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/browser.rb:46:in `initialize'
C:/jenkins/workspace/TEST_IE10/server/cucumber/support/step_support/browsers.rb:212:in `new'
C:/jenkins/workspace/TEST_IE10/server/cucumber/support/step_support/browsers.rb:212:in `new_ie_browser'
C:/jenkins/workspace/TEST_IE10/server/cucumber/support/step_support/browsers.rb:99:in `new_browser'
C:/jenkins/workspace/TEST_IE10/server/cucumber/support/step_support/browsers.rb:132:in `browser'
C:/jenkins/workspace/TEST_IE10/server/cucumber/client/features/support/clients/client_support.rb:54:in `new_client'
C:/jenkins/workspace/TEST_IE10/server/cucumber/client/features/support/clients/client_support.rb:72:in `client'
C:/jenkins/workspace/TEST_IE10/server/cucumber/client/features/support/clients/client_steps.rb:14:in `Before'
通常沒有進一步的測試運行將工作,直到我重新啓動虛擬機,然後再工作幾天。
我檢查硒的webdriver的代碼和發生故障的線路是:
info = Socket.getaddrinfo "localhost", 80, Socket::AF_INET, Socket::SOCK_STREAM
我們在使用無代理和通信應該只在出內網發生。互聯網接入雖然可用。 hosts文件不包含localhost的任何條目。我們使用的是selenium-webdriver 2.34.0。我們使用相同配置的Win7/IE9虛擬機沒有這樣的問題。
Windows上的默認主機文件包含顯式註釋:「本地主機名稱解析在DNS本身內處理」,並且定義「127.0.0.1 localhost」的行被註釋。 – Sampo