0

很长一段时间以来,我一直在 Internet Explorer 上使用 watir。我现在正试图让 watir-webdriver 工作。我已经安装IEDriverServer.exe在我的路径中。

我有一个网站在我的本地机器上运行,它正在监听端口 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>'
4

1 回答 1

0

很晚了,但是如果您查看 selenium webdriver ,C:\Systemtest\Ruby200\lib\ruby\gems\2.0.0\gems\selenium-webdriver-2.47.1\lib\selenium\webdriver\ie\bridge.rb您会看到默认端口设置为 5555:

module Selenium
  module WebDriver
    module IE

      #
      # @api private
      #

      class Bridge < Remote::Bridge

        HOST            = Platform.localhost
        DEFAULT_PORT    = 5555
        DEFAULT_TIMEOUT = 30
于 2015-08-27T12:26:15.817 回答