2013-03-21 63 views
0

我一直在用Internet Explorer長時間使用watir。我現在只是想讓watir-webdriver工作。我在我的路徑中安裝了IEDriverServer.exe在windows上使用watir-webdriver

我有一個網站在我的本地機器上運行,它正在端口80上偵聽,我試圖用我的watir測試來打該網站。通常在watir(沒有webdriver)的情況下,IE只會啓動並打到我指定的任何URL,例如http://MY-MACHINE-NAME/default.aspx。但是,當IEDriverServer啓動時,它似乎在監聽5555等一些隨機端口。因此,IE將在地址欄中啓動並顯示諸如http://localhost:5555/之類的內容。之後,我在下面的堆棧跟蹤中發現錯誤。

我想我有一個基本的誤解,就如何讓watir使用webdriver在端口80上打我的網站,就像沒有它一樣。任何提示將不勝感激。

感謝

C:\Home\Server\Test\Watir\web>ruby ViewOrgBillingProfiles_test.rb --name test_04_filtering 
Started InternetExplorerDriver server (64-bit) 
2.31.0.0 
Listening on port 5555 
C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `initialize': No connection could be made because the target machine actively refused it. - connec 
t(2) (Errno::ECONNREFUSED) 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `open' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `block in connect' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/timeout.rb:54:in `timeout' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/timeout.rb:99:in `timeout' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:762:in `connect' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:755:in `do_start' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:744:in `start' 
    from C:/DevInstallations/Ruby193/lib/ruby/1.9.1/net/http.rb:1284:in `request' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:82:in `response_for' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/default.rb:38:in `request' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/http/common.rb:40:in `call' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:598:in `raw_execute' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:576:in `execute' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/remote/bridge.rb:189:in `quit' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/ie/bridge.rb:59:in `quit' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/selenium-webdriver-2.25.0/lib/selenium/webdriver/common/driver.rb:166:in `quit' 
    from C:/DevInstallations/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.1/lib/watir-webdriver/browser.rb:87:in `close' 
    from C:/Home/Server/Test/Watir/shared/setup.rb:1:in `block in <top (required)>' 
C:/Home/Server/Test/Watir/shared/setup.rb:45:in `start_ie': undefined method `speed=' for #<Watir::Browser:0x..fdf634488 closed=false> (NoMethodError) 
    from C:/Home/Server/Test/Watir/shared/setup.rb:106:in `<top (required)>' 
    from   C:/DevInstallations/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from C:/DevInstallations/Ruby193/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' 
    from ViewOrgBillingProfiles_test.rb:2:in `<main>' 
+1

請分享有關Ruby代碼 – 2013-03-22 09:38:05

+0

我設法克服了這個問題。謝謝。我現在的問題是1)試圖讓chromedriver.exe日誌記錄停止輸出到測試結果輸出中,並且2)嘗試使用stackoverflow來通知我有關我的問題的回覆! – 2013-04-04 22:39:44

+0

如果您已解決問題,請告訴我們解決方案是什麼。 – 2013-04-05 07:39:11

回答

0

路晚,但如果你在C:\Systemtest\Ruby200\lib\ruby\gems\2.0.0\gems\selenium-webdriver-2.47.1\lib\selenium\webdriver\ie\bridge.rb看看硒的webdriver你會看到默認的端口設置爲5555:

module Selenium 
    module WebDriver 
    module IE 

     # 
     # @api private 
     # 

     class Bridge < Remote::Bridge 

     HOST   = Platform.localhost 
     DEFAULT_PORT = 5555 
     DEFAULT_TIMEOUT = 30